public MyGuiScreenTriggerTimeLimit(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_labelMinutesLeft = new MyGuiControlLabel( originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top), size: new Vector2(0.013f, 0.035f), text: MyTexts.Get(MySpaceTexts.GuiTriggerTimeLimit).ToString() ); left += m_labelMinutesLeft.Size.X + spacingH; m_minutesLimit = 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 = "minutes" }; m_minutesLimit.TextChanged += OnTimeChanged; AddCaption(MySpaceTexts.GuiTriggerCaptionTimeLimit); Controls.Add(m_labelMinutesLeft); Controls.Add(m_minutesLimit); m_minutesLimit.Text = ((MyTriggerTimeLimit)trg).LimitInMinutes.ToString(); }
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(); }
private void OnTriggerEnter(Collider other) { MyTrigger trigger = other.GetComponent <MyTrigger>(); if (trigger == null) { return; } if (CompareTag("NPC") && trigger.CompareTag("Goal")) { return; } trigger.On(); }
public void OnTriggerExit(Collider other) { MyTrigger trigger = other.GetComponent <MyTrigger>(); if (trigger == null) { return; } if (CompareTag("NPC") && trigger.CompareTag("Goal")) { return; } trigger.Off(); }
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(null, 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_textboxMessage = new MyGuiControlTextbox( position: m_itemPos, defaultText: trg.Message, maxLength: 85); m_itemPos.Y += m_textboxMessage.Size.Y + VERTICAL_OFFSET + 0.2f; //line to the left of textbox m_textboxName.Position = m_textboxName.Position - new Vector2(m_textboxMessage.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_textboxMessage); Controls.Add(m_okButton); Controls.Add(m_cancelButton); }
public void Using_insert_trigger() { var mage = new Mage("Merlin", 3.3, 3.4); var myTrigger = new MyTrigger(); using (var odb = OdbFactory.Open(DbName)) { odb.TriggerManagerFor <Mage>().AddInsertTrigger(myTrigger); odb.Store(mage); } Assert.That(myTrigger.BeforeInvoked, Is.True); Assert.That(myTrigger.AfterInvoked, Is.True); using (var odb = OdbFactory.Open(DbName)) { var query = odb.Query <Mage>(); var merlin = query.Execute <Mage>().GetFirst(); Assert.That((object)merlin.Attack, Is.EqualTo(3.3 + 1.1)); } }
public void Using_insert_trigger() { var mage = new Mage("Merlin", 3.3, 3.4); var myTrigger = new MyTrigger(); using (var odb = OdbFactory.Open(DbName)) { odb.TriggerManagerFor<Mage>().AddInsertTrigger(myTrigger); odb.Store(mage); } Assert.That(myTrigger.BeforeInvoked, Is.True); Assert.That(myTrigger.AfterInvoked, Is.True); using (var odb = OdbFactory.Open(DbName)) { var query = odb.Query<Mage>(); var merlin = query.Execute<Mage>().GetFirst(); Assert.That((object) merlin.Attack, Is.EqualTo(3.3 + 1.1)); } }
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 m_wwwTextbox.TextChanged += OnWwwTextChanged; 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: m_trigger.NextMission, 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 m_nextMisTextbox.SetToolTip(MySpaceTexts.GuiTriggerNextMissionTooltip); 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); OnWwwTextChanged(m_wwwTextbox); }
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); }
public MyGuiScreenTriggerNoSpawn(MyTrigger trg) : base(trg, MySpaceTexts.GuiTriggerNoSpawnTimeLimit) { AddCaption(MySpaceTexts.GuiTriggerCaptionNoSpawn); m_textboxTime.Text = ((MyTriggerNoSpawn)trg).LimitInSeconds.ToString(); }
public MyGuiScreenTriggerAllOthersLost(MyTrigger trg) : base(trg, new Vector2(0.5f, 0.3f)) { AddCaption(MySpaceTexts.GuiTriggerCaptionAllOthersLost); }
public MyGuiScreenTriggerTimeLimit(MyTrigger trg) : base(trg, MySpaceTexts.GuiTriggerTimeLimit) { AddCaption(MySpaceTexts.GuiTriggerCaptionTimeLimit); m_textboxTime.Text = ((MyTriggerTimeLimit)trg).LimitInMinutes.ToString(); }
public MyGuiScreenTriggerSomeoneWon(MyTrigger trg) : base(trg, new Vector2(0.5f, 0.3f)) { AddCaption(MySpaceTexts.GuiTriggerCaptionSomeoneWon); }
public S3Appender() { Evaluator = new MyTrigger(); }