상속: FSO.Client.UI.Framework.UIContainer
예제 #1
0
        public UIBHAVEditor(BHAV target, EditorScope scope)
        {
            BHAVView = new BHAVContainer(target, scope);

            PlacingName = new UILabel();
            PlacingName.Alignment = TextAlignment.Center;
            PlacingName.Size = new Vector2(1, 1);
            PlacingName.CaptionStyle = TextStyle.DefaultLabel.Clone();
            PlacingName.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont;
            PlacingName.CaptionStyle.Size = 14;
            PlacingName.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingName.Caption = "Placing Report Metric";

            PlacingDesc = new UILabel();
            PlacingDesc.Alignment = TextAlignment.Center;
            PlacingDesc.Size = new Vector2(1, 1);
            PlacingDesc.CaptionStyle = TextStyle.DefaultLabel.Clone();
            PlacingDesc.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont;
            PlacingDesc.CaptionStyle.Size = 12;
            PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingDesc.Caption = "Press ESC to cancel.";
            this.Add(BHAVView);

            this.Add(PlacingName);
            this.Add(PlacingDesc);
        }
예제 #2
0
 public PrimitiveBox(BHAVInstruction inst, BHAVContainer master)
 {
     TreeBox     = new TREEBox(null);
     Master      = master;
     Instruction = inst;
     HitTest     = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));
     PreparePrimitive();
 }
예제 #3
0
 public PrimitiveBox(PrimBoxType mode, BHAVContainer master)
 {
     Type = mode;
     if (mode == PrimBoxType.True) InstPtr = 254;
     else InstPtr = 255;
     Master = master;
     Nodes = new PrimitiveNode[0];
     Width = 32;
     Height = 32;
     HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));
 }
예제 #4
0
 public PrimitiveBox(PrimBoxType mode, BHAVContainer master)
 {
     Type = mode;
     if (mode == PrimBoxType.True)
     {
         InstPtr = 254;
     }
     else
     {
         InstPtr = 255;
     }
     Master  = master;
     Nodes   = new PrimitiveNode[0];
     Width   = 32;
     Height  = 32;
     HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));
 }
예제 #5
0
        public PrimitiveBox(BHAVInstruction inst, byte ptr, BHAVContainer master)
        {
            Type        = PrimBoxType.Primitive;
            Instruction = inst;
            Descriptor  = PrimitiveRegistry.GetDescriptor(inst.Opcode);
            Operand     = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType);
            Operand.Read(inst.Operand);
            InstPtr = ptr;

            Nodes    = new PrimitiveNode[2];
            Nodes[0] = new PrimitiveNode
            {
                Type = NodeType.False
            };
            Nodes[1] = new PrimitiveNode
            {
                Type = NodeType.True
            };

            Title = new UILabel
            {
                Alignment = TextAlignment.Middle | TextAlignment.Center,
                Y         = 0,
                X         = 0
            };
            this.Add(Title);
            Title.CaptionStyle      = TextStyle.DefaultLabel.Clone();
            Title.CaptionStyle.Font = Client.GameFacade.EdithFont;
            Title.CaptionStyle.Size = 14;

            BodyTextStyle      = TextStyle.DefaultLabel.Clone();
            BodyTextStyle.Font = Client.GameFacade.EdithFont;
            BodyTextStyle.Size = 12;

            this.Add(Nodes[0]);
            this.Add(Nodes[1]);

            HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));

            Master = master;
            UpdateDisplay();
        }
예제 #6
0
 public void SwitchBHAV(BHAV target, EditorScope scope, VMStackFrame frame)
 {
     Remove(BHAVView);
     if (ContainerByID.ContainsKey(target.ChunkID))
     {
         BHAVView = ContainerByID[target.ChunkID];
         AddAt(0, BHAVView);
     }
     else
     {
         BHAVView = new BHAVContainer(target, scope);
         ContainerByID.Add(target.ChunkID, BHAVView);
         AddAt(0, BHAVView);
     }
     if (DebugMode)
     {
         DebugFrame = frame;
         UpdateDebugPointer(frame);
     }
 }
예제 #7
0
        public PrimitiveBox(BHAVInstruction inst, byte ptr, BHAVContainer master)
        {
            Type = PrimBoxType.Primitive;
            Instruction = inst;
            Descriptor = PrimitiveRegistry.GetDescriptor(inst.Opcode);
            Operand = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType);
            Operand.Read(inst.Operand);
            InstPtr = ptr;

            Nodes = new PrimitiveNode[2];
            Nodes[0] = new PrimitiveNode();
            Nodes[0].Type = NodeType.False;
            Nodes[1] = new PrimitiveNode();
            Nodes[1].Type = NodeType.True;

            Title = new UILabel();
            Title.Alignment = TextAlignment.Middle | TextAlignment.Center;
            Title.Y = 0;
            Title.X = 0;
            this.Add(Title);
            Title.CaptionStyle = TextStyle.DefaultLabel.Clone();
            Title.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont;
            Title.CaptionStyle.Size = 14;

            BodyTextStyle = TextStyle.DefaultLabel.Clone();
            BodyTextStyle.Font = FSO.Client.GameFacade.EdithFont;
            BodyTextStyle.Size = 12;

            this.Add(Nodes[0]);
            this.Add(Nodes[1]);

            HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));

            Master = master;
            UpdateDisplay();
        }
예제 #8
0
        public UIBHAVEditor(BHAV target, EditorScope scope, VMEntity debugEnt)
        {
            if (debugEnt != null)
            {
                DebugMode = true;
                DebugEntity = debugEnt;
            }

            ContainerByID = new Dictionary<ushort, BHAVContainer>();
            BHAVView = new BHAVContainer(target, scope);
            ContainerByID.Add(target.ChunkID, BHAVView);
            this.Add(BHAVView);

            PlacingName = new UILabel();
            PlacingName.Alignment = TextAlignment.Center;
            PlacingName.Size = new Vector2(1, 1);
            PlacingName.CaptionStyle = TextStyle.DefaultLabel.Clone();
            PlacingName.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont;
            PlacingName.CaptionStyle.Size = 14;
            PlacingName.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingName.Caption = "Placing Report Metric";

            PlacingDesc = new UILabel();
            PlacingDesc.Alignment = TextAlignment.Center;
            PlacingDesc.Size = new Vector2(1, 1);
            PlacingDesc.CaptionStyle = TextStyle.DefaultLabel.Clone();
            PlacingDesc.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont;
            PlacingDesc.CaptionStyle.Size = 12;
            PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingDesc.Caption = "Press ESC to cancel.";

            this.Add(PlacingName);
            this.Add(PlacingDesc);

            if (DebugMode)
            {
                DebugFrame = debugEnt.Thread.Stack.LastOrDefault();
                UpdateDebugPointer(DebugFrame);
                DebugGo = new UIButton();
                DebugGo.Caption = "Go";
                DebugGo.Position = new Vector2(15, 15);
                Add(DebugGo);
                DebugGo.OnButtonClick += DebugButtonClick;

                DebugStepOver = new UIButton();
                DebugStepOver.Caption = "Step Over";
                DebugStepOver.Position = new Vector2(83, 15);
                Add(DebugStepOver);
                DebugStepOver.OnButtonClick += DebugButtonClick;

                DebugStepIn = new UIButton();
                DebugStepIn.Caption = "Step In";
                DebugStepIn.Position = new Vector2(193, 15);
                Add(DebugStepIn);
                DebugStepIn.OnButtonClick += DebugButtonClick;

                DebugStepOut = new UIButton();
                DebugStepOut.Caption = "Step Out";
                DebugStepOut.Position = new Vector2(293, 15);
                Add(DebugStepOut);
                DebugStepOut.OnButtonClick += DebugButtonClick;

                DebugTrue = new UIButton();
                DebugTrue.Caption = "Return True";
                DebugTrue.Position = new Vector2(402, 15);
                Add(DebugTrue);
                DebugTrue.OnButtonClick += DebugButtonClick;

                DebugFalse = new UIButton();
                DebugFalse.Caption = "Return False";
                DebugFalse.Position = new Vector2(522, 15);
                Add(DebugFalse);
                DebugFalse.OnButtonClick += DebugButtonClick;
            }
        }
예제 #9
0
 public void SwitchBHAV(BHAV target, EditorScope scope, VMStackFrame frame)
 {
     Remove(BHAVView);
     if (ContainerByID.ContainsKey(target.ChunkID))
     {
         BHAVView = ContainerByID[target.ChunkID];
         AddAt(0, BHAVView);
     } else
     {
         BHAVView = new BHAVContainer(target, scope);
         ContainerByID.Add(target.ChunkID, BHAVView);
         AddAt(0, BHAVView);
     }
     if (DebugMode)
     {
         DebugFrame = frame;
         UpdateDebugPointer(frame);
     }
 }
예제 #10
0
        public UIBHAVEditor(BHAV target, EditorScope scope, VMEntity debugEnt)
        {
            if (debugEnt != null)
            {
                DebugMode   = true;
                DebugEntity = debugEnt;
            }

            ContainerByID = new Dictionary <ushort, BHAVContainer>();
            BHAVView      = new BHAVContainer(target, scope);
            ContainerByID.Add(target.ChunkID, BHAVView);
            this.Add(BHAVView);

            GameThread.NextUpdate(x =>
            {
                var basePrim = BHAVView.RealPrim.FirstOrDefault();
                if (basePrim != null)
                {
                    BHAVView.Position = GetCentralLocation(basePrim);
                }
            });

            PlacingName                    = new UILabel();
            PlacingName.Alignment          = TextAlignment.Center;
            PlacingName.Size               = new Vector2(1, 1);
            PlacingName.CaptionStyle       = TextStyle.DefaultLabel.Clone();
            PlacingName.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
            PlacingName.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont;
            PlacingName.CaptionStyle.Size  = 15;
            PlacingName.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingName.Caption = "Placing Report Metric";

            PlacingDesc                    = new UILabel();
            PlacingDesc.Alignment          = TextAlignment.Center;
            PlacingDesc.Size               = new Vector2(1, 1);
            PlacingDesc.CaptionStyle       = TextStyle.DefaultLabel.Clone();
            PlacingDesc.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
            PlacingDesc.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont;
            PlacingDesc.CaptionStyle.Size  = 12;
            PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingDesc.Caption = "Press ESC to cancel.";

            this.Add(PlacingName);
            this.Add(PlacingDesc);

            if (DebugMode)
            {
                this.Add(new UITracerBar());

                var resource = EditorResource.Get().Indexed;
                DebugFrame = debugEnt.Thread.Stack.LastOrDefault();
                UpdateDebugPointer(DebugFrame);
                DebugGo          = new UIButton();
                DebugGo.Texture  = resource[0];
                DebugGo.Tooltip  = "Go";
                DebugGo.Position = new Vector2(10, 5);
                Add(DebugGo);
                DebugGo.OnButtonClick += DebugButtonClick;

                DebugStepIn          = new UIButton();
                DebugStepIn.Tooltip  = "Step In";
                DebugStepIn.Texture  = resource[1];
                DebugStepIn.Position = new Vector2(35, 5);
                Add(DebugStepIn);
                DebugStepIn.OnButtonClick += DebugButtonClick;

                DebugStepOver          = new UIButton();
                DebugStepOver.Tooltip  = "Step Over";
                DebugStepOver.Texture  = resource[2];
                DebugStepOver.Position = new Vector2(60, 5);
                Add(DebugStepOver);
                DebugStepOver.OnButtonClick += DebugButtonClick;

                DebugStepOut          = new UIButton();
                DebugStepOut.Tooltip  = "Step Out";
                DebugStepOut.Texture  = resource[3];
                DebugStepOut.Position = new Vector2(85, 5);
                Add(DebugStepOut);
                DebugStepOut.OnButtonClick += DebugButtonClick;

                DebugTrue          = new UIButton();
                DebugTrue.Tooltip  = "Return True";
                DebugTrue.Texture  = resource[4];
                DebugTrue.Position = new Vector2(LastWidth - 80, 5);
                Add(DebugTrue);
                DebugTrue.OnButtonClick += DebugButtonClick;

                DebugFalse          = new UIButton();
                DebugFalse.Tooltip  = "Return False";
                DebugFalse.Texture  = resource[5];
                DebugFalse.Position = new Vector2(LastWidth - 55, 5);
                Add(DebugFalse);
                DebugFalse.OnButtonClick += DebugButtonClick;

                DebugReset          = new UIButton();
                DebugReset.Tooltip  = "Reset Object";
                DebugReset.Texture  = resource[6];
                DebugReset.Position = new Vector2(LastWidth - 30, 5);
                Add(DebugReset);
                DebugReset.OnButtonClick += DebugButtonClick;

                DebugLabel = new UILabel();
                DebugLabel.CaptionStyle       = TextStyle.DefaultLabel.Clone();
                DebugLabel.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
                DebugLabel.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont;
                DebugLabel.CaptionStyle.Size  = 12;
                DebugLabel.CaptionStyle.Color = Color.White;
                DebugLabel.Caption            = "Breakpoint Hit.";
                DebugLabel.Position           = new Vector2(115, 9);
                Add(DebugLabel);
            }
        }
예제 #11
0
        public UIBHAVEditor(BHAV target, EditorScope scope, VMEntity debugEnt)
        {
            if (debugEnt != null)
            {
                DebugMode   = true;
                DebugEntity = debugEnt;
            }

            ContainerByID = new Dictionary <ushort, BHAVContainer>();
            BHAVView      = new BHAVContainer(target, scope);
            ContainerByID.Add(target.ChunkID, BHAVView);
            this.Add(BHAVView);

            PlacingName                    = new UILabel();
            PlacingName.Alignment          = TextAlignment.Center;
            PlacingName.Size               = new Vector2(1, 1);
            PlacingName.CaptionStyle       = TextStyle.DefaultLabel.Clone();
            PlacingName.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
            PlacingName.CaptionStyle.Size  = 14;
            PlacingName.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingName.Caption = "Placing Report Metric";

            PlacingDesc                    = new UILabel();
            PlacingDesc.Alignment          = TextAlignment.Center;
            PlacingDesc.Size               = new Vector2(1, 1);
            PlacingDesc.CaptionStyle       = TextStyle.DefaultLabel.Clone();
            PlacingDesc.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
            PlacingDesc.CaptionStyle.Size  = 12;
            PlacingDesc.CaptionStyle.Color = new Color(0, 102, 26);

            PlacingDesc.Caption = "Press ESC to cancel.";

            this.Add(PlacingName);
            this.Add(PlacingDesc);

            if (DebugMode)
            {
                DebugFrame = debugEnt.Thread.Stack.LastOrDefault();
                UpdateDebugPointer(DebugFrame);
                DebugGo          = new UIButton();
                DebugGo.Caption  = "Go";
                DebugGo.Position = new Vector2(15, 15);
                Add(DebugGo);
                DebugGo.OnButtonClick += DebugButtonClick;

                DebugStepOver          = new UIButton();
                DebugStepOver.Caption  = "Step Over";
                DebugStepOver.Position = new Vector2(83, 15);
                Add(DebugStepOver);
                DebugStepOver.OnButtonClick += DebugButtonClick;

                DebugStepIn          = new UIButton();
                DebugStepIn.Caption  = "Step In";
                DebugStepIn.Position = new Vector2(193, 15);
                Add(DebugStepIn);
                DebugStepIn.OnButtonClick += DebugButtonClick;

                DebugStepOut          = new UIButton();
                DebugStepOut.Caption  = "Step Out";
                DebugStepOut.Position = new Vector2(293, 15);
                Add(DebugStepOut);
                DebugStepOut.OnButtonClick += DebugButtonClick;

                DebugTrue          = new UIButton();
                DebugTrue.Caption  = "Return True";
                DebugTrue.Position = new Vector2(402, 15);
                Add(DebugTrue);
                DebugTrue.OnButtonClick += DebugButtonClick;

                DebugFalse          = new UIButton();
                DebugFalse.Caption  = "Return False";
                DebugFalse.Position = new Vector2(522, 15);
                Add(DebugFalse);
                DebugFalse.OnButtonClick += DebugButtonClick;
            }
        }
예제 #12
0
        public PrimitiveBox(TREEBox box, BHAVContainer master)
        {
            TreeBox = box;
            Master  = master;
            Nodes   = new PrimitiveNode[0];
            ApplyBoxPosition();
            HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));
            Texture2D sliceTex = null;

            switch (Type)
            {
            case TREEBoxType.Primitive:
                Instruction = master.GetInstruction(box.TrueID);
                PreparePrimitive();
                break;

            case TREEBoxType.True:
            case TREEBoxType.False:
                RecenterSize(32, 32);
                break;

            case TREEBoxType.Label:
                sliceTex         = EditorResource.Get().LabelBox;
                Nodes            = new PrimitiveNode[2];
                Nodes[0]         = new PrimitiveNode();
                Nodes[0].Visible = false;
                Nodes[1]         = new PrimitiveNode();
                Nodes[1].Type    = NodeType.Done;
                this.Add(Nodes[0]);
                this.Add(Nodes[1]);

                TextEdit                     = new UITextEdit();
                TextEdit.OnChange           += (elem) => { CommentChanged(); };
                TextEdit.OnFocusOut         += TextEdit_OnFocusOut;
                TextEdit.TextStyle           = EditorResource.Get().TitleStyle;
                TextEdit.Alignment           = TextAlignment.Center;
                TextEdit.CurrentText         = TreeBox.Comment;
                TextEdit.NoFocusPassthrough += MouseEvents;
                Add(TextEdit);
                CommentResized();
                break;

            case TREEBoxType.Goto:
                sliceTex = EditorResource.Get().GotoBox;

                Title           = new UILabel();
                Title.Alignment = TextAlignment.Middle | TextAlignment.Center;
                Title.Y         = 0;
                Title.X         = 0;
                this.Add(Title);
                Title.CaptionStyle = EditorResource.Get().TitleStyle;

                UpdateGotoLabel();
                break;

            case TREEBoxType.Comment:
                sliceTex                     = EditorResource.Get().CommentBox;
                TextEdit                     = new UITextEdit();
                TextEdit.OnChange           += (elem) => { CommentChanged(); };
                TextEdit.OnFocusOut         += TextEdit_OnFocusOut;
                TextEdit.TextStyle           = EditorResource.Get().CommentStyle;
                TextEdit.CurrentText         = TreeBox.Comment;
                TextEdit.NoFocusPassthrough += MouseEvents;
                Add(TextEdit);
                CommentResized();
                break;
            }
            if (sliceTex != null)
            {
                var sliceW = sliceTex.Width / 3;
                var sliceH = sliceTex.Height / 3;
                SliceBg        = new UIImage(sliceTex).With9Slice(sliceW, sliceW, sliceH, sliceH);
                SliceBg.Width  = Width;
                SliceBg.Height = Height;
                Add(SliceBg);
            }
        }