public MyGuiScreenTriggerTime(MyTrigger trg, MyStringId labelText)
            : base(trg, new Vector2(WINSIZEX + 0.1f, WINSIZEY))
        {
            float left = m_textboxMessage.Position.X-m_textboxMessage.Size.X/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            m_labelTime = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.013f, 0.035f),
                text: MyTexts.Get(labelText).ToString()//text: MyTexts.Get(MySpaceTexts.GuiTriggerTimeLimit).ToString()
            );
            left += m_labelTime.Size.X + spacingH;
            m_textboxTime = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.05f, 0.035f),
                Type = MyGuiControlTextboxType.DigitsOnly,
                Name = "time"
            };
            m_textboxTime.TextChanged += OnTimeChanged;

            Controls.Add(m_labelTime);
            Controls.Add(m_textboxTime);

        }
        public MyGuiScreenTriggerLives(MyTrigger trg)
            : base(trg, new Vector2(WINSIZEX + 0.1f, WINSIZEY))
        {
            float left = m_textboxMessage.Position.X-m_textboxMessage.Size.X/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            m_labelLives = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.GuiTriggersLives).ToString()
            );
            left += m_labelLives.Size.X + spacingH;
            m_lives = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelLives.Size.X, 0.035f),
                Type = MyGuiControlTextboxType.DigitsOnly,
                Name = "lives"
            };
            m_lives.TextChanged += OnLivesChanged;

            AddCaption(MySpaceTexts.GuiTriggerCaptionLives);
            Controls.Add(m_labelLives);
            Controls.Add(m_lives);

            m_lives.Text = ((MyTriggerLives)trg).LivesLeft.ToString();
        }
示例#3
0
 public MyTrigger(MyTrigger trg)
 {
     m_IsTrue = trg.m_IsTrue;
     if (trg.Message != null)
     {
         Message = string.Copy(trg.Message);
     }
 }
 public MyGuiScreenTriggerPositionReached(MyTrigger trg)
     : base(trg)
 {
     AddCaption(MySpaceTexts.GuiTriggerCaptionPositionReached);
     m_xCoord.Text = ((MyTriggerPositionReached)trg).TargetPos.X.ToString();
     m_yCoord.Text = ((MyTriggerPositionReached)trg).TargetPos.Y.ToString();
     m_zCoord.Text = ((MyTriggerPositionReached)trg).TargetPos.Z.ToString();
     m_radius.Text = ((MyTriggerPositionReached)trg).Radius.ToString();
 }
示例#5
0
        public MyTrigger(MyTrigger trg)
        {
            m_IsTrue = trg.m_IsTrue;
            if (trg.Message!=null)
                Message = string.Copy(trg.Message);
            if (trg.WwwLink != null)
                WwwLink = string.Copy(trg.WwwLink);
            if (trg.NextMission!= null)
                NextMission = string.Copy(trg.NextMission);

        }
示例#6
0
 public MyTrigger(MyTrigger trg)
 {
     m_IsTrue = trg.m_IsTrue;
     if (trg.Message != null)
     {
         Message = string.Copy(trg.Message);
     }
     if (trg.WwwLink != null)
     {
         WwwLink = string.Copy(trg.WwwLink);
     }
     if (trg.NextMission != null)
     {
         NextMission = string.Copy(trg.NextMission);
     }
 }
        public MyGuiScreenTriggerBlockDestroyed(MyTrigger trig) : base(trig,new Vector2(0.5f,0.8f))
        {
            trigger=(MyTriggerBlockDestroyed)trig;
            AddCaption(MySpaceTexts.GuiTriggerCaptionBlockDestroyed);

            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(10, 30, 3, 30, 10);
            layout.SetRowHeightsNormalized(20, 35, 6, 4, 4, 5, 33);

            m_selectedBlocks = new MyGuiControlTable();
            m_selectedBlocks.VisibleRowsCount = 8;
            m_selectedBlocks.ColumnsCount = 1;
            m_selectedBlocks.SetCustomColumnWidths(new float[]{1});
            m_selectedBlocks.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyed_ColumnName));

            layout.AddWithSize(m_selectedBlocks, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);

            m_buttonPaste = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnPasteButtonClick
                );
            m_buttonPaste.SetToolTip(MySpaceTexts.GuiTriggerPasteBlocksTooltip);
            layout.AddWithSize(m_buttonPaste, MyAlignH.Left, MyAlignV.Top, 2, 1, rowSpan: 1, colSpan: 1);

            m_buttonDelete = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerDeleteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnDeleteButtonClick);
            layout.AddWithSize(m_buttonDelete, MyAlignH.Left, MyAlignV.Top, 2, 3, rowSpan: 1, colSpan: 1);

            m_labelSingleMessage = new MyGuiControlLabel(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyedSingleMessage).ToString()
                );
            layout.AddWithSize(m_labelSingleMessage, MyAlignH.Left, MyAlignV.Top, 3, 1, rowSpan: 1, colSpan: 1);
            m_textboxSingleMessage = new MyGuiControlTextbox(
                defaultText: trigger.SingleMessage,
                maxLength: 85);
            layout.AddWithSize(m_textboxSingleMessage, MyAlignH.Left, MyAlignV.Top, 4, 1, rowSpan: 1, colSpan: 3);

            foreach(var block in trigger.Blocks)
                AddRow(block.Key);
            m_tempSb.Clear().Append(trigger.SingleMessage);
            m_textboxSingleMessage.SetText(m_tempSb);

        }
        public MyGuiScreenTrigger(MyTrigger trg, Vector2 size)
            : base(size, MyGuiConstants.SCREEN_BACKGROUND_COLOR, size)
        {
            Vector2 m_itemPos=new Vector2();
            m_itemPos.Y = - size.Y / 2 + 0.1f;
            m_textboxName=new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerMessage).ToString()
                );
            m_itemPos.Y += m_textboxName.Size.Y + VERTICAL_OFFSET;

            m_trigger = trg;
            m_textbox = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.Message,
                maxLength: 85);
            m_itemPos.Y += m_textbox.Size.Y + VERTICAL_OFFSET + 0.2f;
            //line to the left of textbox
            m_textboxName.Position = m_textboxName.Position-new Vector2(m_textbox.Size.X / 2 , 0);

            Vector2 buttonOrigin = new Vector2(0f, Size.Value.Y * 0.4f);
            Vector2 buttonOffset = new Vector2(0.01f, 0f); 
            
            m_okButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Ok),
                onButtonClick: OnOkButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_okButton.Position = buttonOrigin - buttonOffset;

            m_cancelButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Cancel),
                onButtonClick: OnCancelButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cancelButton.Position = buttonOrigin + buttonOffset;

            Controls.Add(m_textboxName);
            Controls.Add(m_textbox);
            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);
        }
        public MyGuiScreenTriggerPosition(MyTrigger trg)
            : base(trg, new Vector2(WINSIZEX+0.1f, WINSIZEY))
        {
            float left = MIDDLE_PART_ORIGIN.X-WINSIZEX/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            //X,Y,Z:
            m_labelInsX = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_X).ToString()
            );
            left += m_labelInsX.Size.X + spacingH;
            m_xCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsX.Size.X, 0.035f),
                Name = "textX"
            };
            m_xCoord.Enabled = false;
            left += m_xCoord.Size.X + spacingH;

            m_labelInsY = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(WINSIZEX - 0.012f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Y).ToString()
            );
            left += m_labelInsY.Size.X + spacingH;
            m_yCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsY.Size.X, 0.035f),
                Name = "textY"
            };
            m_yCoord.Enabled = false;
            left += m_yCoord.Size.X + spacingH;

            m_labelInsZ = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.TerminalTab_GPS_Z).ToString()
            );
            left += m_labelInsZ.Size.X + spacingH;
            m_zCoord = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsZ.Size.X, 0.035f),
                Name = "textZ"
            };
            m_zCoord.Enabled = false;

            left = MIDDLE_PART_ORIGIN.X - WINSIZEX / 2;
            top += m_zCoord.Size.Y + VERTICAL_OFFSET;
            m_labelRadius = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPositionRadius).ToString()
            );
            left += m_labelRadius.Size.X + spacingH;
            m_radius = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelInsZ.Size.X, 0.035f),
                Name = "radius"
            };
            m_radius.TextChanged += OnRadiusChanged;

            left += m_radius.Size.X + spacingH + 0.05f;
            m_pasteButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteGps),
                visualStyle : MyGuiControlButtonStyleEnum.Small,
                onButtonClick: OnPasteButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left,top));


            Controls.Add(m_labelInsX);
            Controls.Add(m_xCoord);
            Controls.Add(m_labelInsY);
            Controls.Add(m_yCoord);
            Controls.Add(m_labelInsZ);
            Controls.Add(m_zCoord);
            Controls.Add(m_labelRadius);
            Controls.Add(m_radius);
            Controls.Add(m_pasteButton);
        }
示例#10
0
 public static MyObjectBuilder_Trigger CreateObjectBuilder(MyTrigger instance)
 {
     return m_objectFactory.CreateObjectBuilder<MyObjectBuilder_Trigger>(instance);
 }
示例#11
0
 public static MyObjectBuilder_Trigger CreateObjectBuilder(MyTrigger instance)
 {
     return(m_objectFactory.CreateObjectBuilder <MyObjectBuilder_Trigger>(instance));
 }
 public MyGuiScreenTriggerSomeoneWon(MyTrigger trg) : base(trg,new Vector2(0.5f,0.3f))
 {
     AddCaption(MySpaceTexts.GuiTriggerCaptionSomeoneWon);
 }
 public MyGuiScreenTriggerNoSpawn(MyTrigger trg)
     : base(trg, MySpaceTexts.GuiTriggerNoSpawnTimeLimit)
 {
     AddCaption(MySpaceTexts.GuiTriggerCaptionNoSpawn);
     m_textboxTime.Text = ((MyTriggerNoSpawn)trg).LimitInSeconds.ToString();
 }
示例#14
0
 public MyTrigger(MyTrigger trg)
 {
     m_IsTrue = trg.m_IsTrue;
     if (trg.Message!=null)
         Message = string.Copy(trg.Message);
 }
        protected static readonly Vector2 MIDDLE_PART_ORIGIN = -RESERVED_SIZE/2+new Vector2(0, 0.17f);//you can use this to put items into right place in the middle

        public MyGuiScreenTrigger(MyTrigger trg, Vector2 size)
            : base(null, MyGuiConstants.SCREEN_BACKGROUND_COLOR, size + RESERVED_SIZE)
        {
            size += RESERVED_SIZE;
            Vector2 m_itemPos=new Vector2();
            m_itemPos.Y = - size.Y / 2 + 0.1f;
            m_textboxName=new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerMessage).ToString()
                );
            m_itemPos.Y += m_textboxName.Size.Y + VERTICAL_OFFSET;

            m_trigger = trg;
            m_textboxMessage = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.Message,
                maxLength: 85);
            m_textboxName.Position = m_textboxName.Position - new Vector2(m_textboxMessage.Size.X / 2, 0);//line to the left of textbox
            Controls.Add(m_textboxName);
            Controls.Add(m_textboxMessage);

            //below middle part, position from bottom:
            m_itemPos.Y = Size.Value.Y * 0.5f - 0.3f;
            m_wwwLabel = new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerWwwLink).ToString()
                );
            m_itemPos.Y += m_wwwLabel.Size.Y + VERTICAL_OFFSET;
            m_wwwTextbox = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.WwwLink,
                maxLength: 300);
            m_itemPos.Y += m_wwwTextbox.Size.Y + VERTICAL_OFFSET;
            m_wwwLabel.Position = m_wwwLabel.Position - new Vector2(m_wwwTextbox.Size.X / 2, 0);//line to the left of textbox
            Controls.Add(m_wwwLabel);
            Controls.Add(m_wwwTextbox);

            m_nextMisLabel = new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerNextMission).ToString()
                );
            m_itemPos.Y += m_wwwLabel.Size.Y + VERTICAL_OFFSET;
            m_nextMisTextbox = new MyGuiControlTextbox(
                position: m_itemPos,
                //defaultText: trg.WwwLink,
                maxLength: 300);
            m_itemPos.Y += m_wwwTextbox.Size.Y + VERTICAL_OFFSET;
            m_nextMisLabel.Position = m_nextMisLabel.Position - new Vector2(m_nextMisTextbox.Size.X / 2, 0);//line to the left of textbox
            Controls.Add(m_nextMisLabel);
            Controls.Add(m_nextMisTextbox);

            
            Vector2 buttonOrigin = new Vector2(0f, Size.Value.Y * 0.5f - 0.05f);
            Vector2 buttonOffset = new Vector2(0.01f, 0f); 
            
            m_okButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Ok),
                onButtonClick: OnOkButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_okButton.Position = buttonOrigin - buttonOffset;

            m_cancelButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Cancel),
                onButtonClick: OnCancelButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cancelButton.Position = buttonOrigin + buttonOffset;

            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);
        }
 public MyGuiScreenTriggerTimeLimit(MyTrigger trg)
     : base(trg, MySpaceTexts.GuiTriggerTimeLimit)
 {
     AddCaption(MySpaceTexts.GuiTriggerCaptionTimeLimit);
     m_textboxTime.Text = ((MyTriggerTimeLimit)trg).LimitInMinutes.ToString();
 }
 public MyGuiScreenTriggerAllOthersLost(MyTrigger trg) : base(trg,new Vector2(0.5f,0.3f))
 {
     AddCaption(MySpaceTexts.GuiTriggerCaptionAllOthersLost);
 }