示例#1
0
        // Required for all IDumpers for them to work, but can't enforced by the interface because it's static:
        public static RgbaColor CreateFromDump(SafeSharedObjects shared, Dump d)
        {
            var newObj = new RgbaColor();

            newObj.LoadDump(d);
            return(newObj);
        }
示例#2
0
 public RgbaColor(RgbaColor copyFrom)
     : this()
 {
     SafeHouse.Logger.Log(" --RgbaColor.Construct-- ");
     Red   = copyFrom.Red;
     Green = copyFrom.Green;
     Blue  = copyFrom.Blue;
     Alpha = copyFrom.Alpha;
 }
示例#3
0
 public RgbaColor(RgbaColor copyFrom)
     : this()
 {
     SafeHouse.Logger.Log(" --RgbaColor.Construct-- ");
     Red = copyFrom.Red;
     Green = copyFrom.Green;
     Blue = copyFrom.Blue;
     Alpha = copyFrom.Alpha;
 }
示例#4
0
        private const int FLIGHT_LAYER = 0;  // found through trial-and-error

        public VectorRenderer(UpdateHandler updateHand, SharedObjects shared)
        {
            Vector = new Vector3d(0, 0, 0);
            Color  = new RgbaColor(1, 1, 1);
            Start  = new Vector3d(0, 0, 0);
            Scale  = 1.0;
            Width  = 0;

            updateHandler = updateHand;
            this.shared   = shared;
        }
示例#5
0
 public HighlightStructure(UpdateHandler updateHandler, object toHighlight, RgbaColor color)
 {
     this.updateHandler = updateHandler;
     this.toHighlight = toHighlight;
     this.color = color;
     DetermineType();
     InitializeSuffixes();
     stale = true;
     enabled = true;
     updateHandler.AddObserver(this);
 }
示例#6
0
        public VectorRenderer( UpdateHandler updateHand, SharedObjects shared )
        {
            Vector  = new Vector3d(0,0,0);
            Color   = new RgbaColor(1,1,1);
            Start   = new Vector3d(0,0,0);
            Scale   = 1.0;
            Width   = 0;

            updateHandler = updateHand;
            this.shared = shared;
            InitializeSuffixes();
        }
示例#7
0
 private void InitializeSuffixes()
 {
     AddSuffix("COLOR", new SetSuffix<RgbaColor>(() => color, value =>
     {
         color = value;
         stale = true;
     }));
     AddSuffix("ENABLED", new SetSuffix<bool>(() => enabled, value =>
     {
         enabled = value;
         stale = true;
     }));
 }
示例#8
0
        public VectorRenderer(UpdateHandler updateHand, SharedObjects shared)
        {
            Vector = new Vector3d(0, 0, 0);
            Color  = new RgbaColor(1, 1, 1);
            Start  = new Vector3d(0, 0, 0);
            Scale  = 1.0;
            Width  = 0;
            Pointy = false;
            Wiping = false;

            updateHandler = updateHand;
            this.shared   = shared;
            InitializeSuffixes();
        }
示例#9
0
文件: Suffixed.cs 项目: CalebJ2/KOS
        public void DoExecuteWork(SharedObjects shared, Vector start, Vector vec, RgbaColor rgba, string str, double scale, bool show, double width)
        {
            var vRend = new VectorRenderer( shared.UpdateHandler, shared )
                {
                    Vector = vec,
                    Start = start,
                    Color = rgba,
                    Scale = scale,
                    Width = width
                };
            vRend.SetLabel( str );
            vRend.SetShow( show );

            ReturnValue = vRend;
        }
示例#10
0
文件: Suffixed.cs 项目: CalebJ2/KOS
 public override void Execute(SharedObjects shared)
 {
     var a = (float) GetDouble(PopValueAssert(shared));
     var b = (float) GetDouble(PopValueAssert(shared));
     var g = (float) GetDouble(PopValueAssert(shared));
     var r = (float) GetDouble(PopValueAssert(shared));
     AssertArgBottomAndConsume(shared);
     ReturnValue = new RgbaColor(r,g,b,a);
 }
示例#11
0
 public RgbaColor(RgbaColor copyFrom)
 {
     Safe.Utilities.Debug.Logger.Log("kOS: --RgbaColor.Construct-- ");
     color = copyFrom.color;
     InitializeSuffixColor();
 }
示例#12
0
 public RgbaColor(RgbaColor copyFrom)
 {
     SafeHouse.Logger.Log(" --RgbaColor.Construct-- ");
     color = copyFrom.color;
     InitializeSuffixColor();
 }
示例#13
0
        public override bool SetSuffix(string suffixName, object value)
        {
            double dblValue    = 0.0;
            bool   boolValue   = false;
            string strValue    = "";
            var    rgbaValue   = new RgbaColor(1, 1, 1);
            var    vectorValue = new Vector(0, 0, 0);

            // When the wrong type of value is given, attempt
            // to make at least SOME value out of it that won't crash
            // the system.  This was added because now the value can
            // be a wide variety of different types and this check
            // used to deny any of them being usable other than doubles.
            // This is getting a bit silly looking and something else
            // needs to be done, I think.
            if (value is double || value is int || value is float || value is long)
            {
                dblValue  = Convert.ToDouble(value);
                boolValue = (Convert.ToBoolean(value));
            }
            else if (value is bool)
            {
                boolValue = (bool)value;
                dblValue  = ((bool)value) ? 1.0 : 0.0;
            }
            else if (value is RgbaColor)
            {
                rgbaValue = (RgbaColor)value;
            }
            else if (value is Vector)
            {
                vectorValue = (Vector)value;
            }
            else if (value is String)
            {
                strValue = value.ToString();
            }
            else if (!double.TryParse(value.ToString(), out dblValue))
            {
                return(false);
            }

            switch (suffixName)
            {
            case "VEC":
            case "VECTOR":
                Vector = vectorValue.ToVector3D();
                RenderPointCoords();
                return(true);

            case "SHOW":
                SetShow(boolValue);
                return(true);

            case "COLOR":
            case "COLOUR":
                Color = rgbaValue;
                RenderColor();
                return(true);

            case "START":
                Start = vectorValue.ToVector3D();
                RenderPointCoords();
                return(true);

            case "SCALE":
                Scale = dblValue;
                RenderPointCoords();
                return(true);

            case "LABEL":
                SetLabel(strValue);
                return(true);

            case "WIDTH":
                Width = dblValue;
                RenderPointCoords();
                return(true);
            }

            return(base.SetSuffix(suffixName, value));
        }
示例#14
0
文件: RgbaColor.cs 项目: EbbiDos/KOS
 public RgbaColor( RgbaColor copyFrom )
 {
     color = copyFrom.color;
 }
示例#15
0
 public RgbaColor(RgbaColor copyFrom)
 {
     color = copyFrom.color;
 }