Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import flash.display.MovieClip;
- import flash.text.TextField;
- import hudframework.IHUDWidget;
- /**
- */
- import flash.geom.*;
- public class WeapDeg extends MovieClip implements IHUDWidget{
- // HUDFramework Config
- private static const WIDGET_IDENTIFIER:String = "WeaponDegWidget.swf";
- // Command IDs
- private static const Command_UpdateCount:int = 100;
- // Hello World Textfield
- public var count_tf:TextField;
- public function WeapDeg() {}
- var tempCTF:ColorTransform = new ColorTransform();
- var tempCTF:ColorTransform;
- var ct_white = new ColorTransform(0, 0, 0, 1, 255, 255, 255, 0);
- var ct_red = new ColorTransform(0, 0, 0, 1, 255, 32, 32, 0);
- var ct_yellow = new ColorTransform(0, 0, 0, 1, 255, 255, 32, 0);
- var ct_green = new ColorTransform(0, 0, 0, 1, 32, 255, 32, 0);
- public function processMessage(param1:String, param2:Array) : void
- {
- switch(param1)
- {
- case String(Command_UpdateCount):
- this.count_tf.text = String(int(param2[0]));
- if (int(param2[0])>75) {
- this.transform.colorTransform = ct_green;
- } else if (int(param2[0])>25) {
- this.transform.colorTransform = ct_yellow;
- } else {
- this.transform.colorTransform = ct_red;
- }
- break;
- }
- }
- public function getCTF(aiValue: int):ColorTransform
- {
- if (aiValue == 0) {
- tempCTF = new ColorTransform(0, 0, 0, 0.05, 0, 0, 0, 0);
- } else if (aiValue < 50) {
- tempCTF = new ColorTransform(0, 0, 0, 1, 255, 32+aiValue*4.46, 32, 0);
- } else if (aiValue == 50) {
- tempCTF = new ColorTransform(0, 0, 0, 1, 255, 255, 32, 0);
- } else {
- tempCTF = new ColorTransform(0, 0, 0, 1, 32 + (100-aiValue)*4.46, 255, 32, 0);
- }
- return tempCTF;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement