void AddCheat(MyGameplayCheat cheat) { bool enabled = MyGuiScreenGamePlay.Static.CheatsEnabled() && cheat.IsImplemented; MyGuiControlBase control; if (cheat.IsButton) { if (!m_lastWasButton) { m_currentPosition.Y += 0.005f * m_scale; } m_lastWasButton = true; control = AddButton(MyTextsWrapper.Get(cheat.CheatName), onCheatButtonClick, textColor: Vector4.One, size: new Vector2(0.20f, 0.04f)); } else { if (m_lastWasButton) { m_currentPosition.Y += 0.005f * m_scale; } m_lastWasButton = false; control = AddCheckBox(cheat.CheatName, MyGameplayCheats.IsCheatEnabled(cheat.CheatEnum), OnCheatCheckedChanged, enabled, color: Vector4.One); } control.UserData = cheat; control.Enabled = enabled; }
void onCheatButtonClick(MyGuiControlButton sender) { MyGameplayCheat cheat = (MyGameplayCheat)sender.UserData; MyGameplayCheats.EnableCheat(cheat.CheatEnum, true); }
void OnCheatCheckedChanged(MyGuiControlCheckbox sender) { MyGameplayCheat cheat = (MyGameplayCheat)sender.UserData; MyGameplayCheats.EnableCheat(cheat.CheatEnum, sender.Checked); }