/// <summary> /// Move simulation forward /// /// TODO: What is the purpose of this function? (along side SimUpdate) /// </summary> public void SimTick() { if (SimSpeed.IsTrue()) { for (SimPass = 0; SimPass < SimPasses; SimPass++) { SimLoop(true); } } SimUpdate(); }
void ChangeSimSpeed(SimSpeed newSpeed) { SimSpeed oldSpeed = simulator.GetSimSpeed(); string oldStr = $"speed{oldSpeed}"; simSpeedButtons[(int)oldSpeed].sprite = Style.sprites[oldStr]; string newStr = $"speed{newSpeed}Sel"; simSpeedButtons[(int)newSpeed].sprite = Style.sprites[newStr]; simulator.ChangeSimSpeed(newSpeed); }
/// <summary> /// Update ?? /// /// TODO: WHat is the purpose of this function (along with, SimTick) /// </summary> public void SimUpdate() { //printf("simUpdate\n"); BlinkFlag = (short)(((TickCount() % 60) < 30) ? 1 : -1); if (SimSpeed.IsTrue() && HeatSteps.IsFalse()) { TilesAnimated = false; } DoUpdateHeads(); GraphDoer(); UpdateBudget(); ScoreDoer(); }
Panel CreateTimeControlls() { Style.PushStyle("timeBar"); Style.PushStyle("panelSpriteOn"); Layout.PushLayout("timeBar"); Layout.PushLayout("timeBarPanel"); VerticalLayout vertLayout = new VerticalLayout(); Layout.PopLayout("timeBarPanel"); Style.PopStyle("panelSpriteOn"); HorizontalLayout time = new HorizontalLayout(); Text week = new Text($"Week: 111", false).SetTextUpdateFunction(() => { return($"{Texts.Get("week")}: {simulator.week}"); }); Text day = new Text($"Week: 111", false).SetTextUpdateFunction(() => { return($"{Texts.Get("day")}: {simulator.day}"); }); Text progress = new Text($"Week: 111", false).SetTextUpdateFunction(() => { return($"{simulator.GetDayProgress().ToString("p1")}"); }); time.AddChild(week, day, progress); vertLayout.AddChild(time); Style.PushStyle("speedControls"); HorizontalLayout speedControlls = new HorizontalLayout(); simSpeedButtons = new Button[] { new Button(Style.sprites["speedPaused"]), new Button(Style.sprites["speedNormalSel"]), new Button(Style.sprites["speedFast"]), new Button(Style.sprites["speedFaster"]) }; for (int i = 0; i < 4; i++) { SimSpeed speed = (SimSpeed)i; simSpeedButtons[i].OnMouseClick = () => ChangeSimSpeed(speed); speedControlls.AddChild(simSpeedButtons[i]); } Layout.PopLayout("timeBar"); Style.PopStyle("speedControls"); Style.PopStyle("timeBar"); vertLayout.AddChild(speedControlls); return(vertLayout); }
public void ChangeSimSpeed(SimSpeed newSpeed) { simSpeed = newSpeed; }