//command pattern public ICommand ExecuteCommand(BuildingActions command) { switch (command) { case BuildingActions.Place: return(new PlaceBuilding(this)); break; case BuildingActions.Upgrade: return(new PlaceBuilding(this)); break; case BuildingActions.Delete: return(new PlaceBuilding(this)); break; default: return(null); break; } }
public GameStateBuilder <TContext> ThenGoToState(string stateName) { BuildingActions.Add(x => { var ck = CurrentProduct; ck.TargetStateName = stateName; }); return(_Parent); }
public GameStateBuilder <TContext> ThenDo(Action <TContext> changingAction) { BuildingActions.Add(x => { var ck = CurrentProduct; ck.ChangeActions.Add(new ContextDataChangeAction <TContext>() { ChangingAction = changingAction }); }); return(_Parent); }
public ContextDataChangeCheckerBuilder <TContext> HasCheckerForContextDataChange(Func <TContext, bool> checkLogic) { var bd = new ContextDataChangeCheckerBuilder <TContext>(this); BuildingActions.Add(x => { var ck = bd.CurrentProduct; ck.CheckContextFunction = checkLogic; }); return(bd); }
public Buildings(string token) { Left = 610; Top = 25; InitializeComponent(); // set the storage and load the building list const string storageColumns = "Date,Building"; _storage = new StoreData("Buildings", storageColumns); var items = _storage.ReadLines(); for (var i = 1; i < items.Length; i++) // do not add the column names to list { scheduleList.Items.Add(items[i].Replace(",", "|")); } // set tribal wars api object _command = new BuildingActions(token); // set all the current building levels SetBuildignLevels(); // set the tray icon var trayIcon = new NotifyIcon(); trayIcon.Text = "My application"; trayIcon.Icon = new Icon("Building.ico"); // Add menu to tray icon and show it. var cm = new ContextMenu(); cm.MenuItems.Add("Show", OnShow); cm.MenuItems.Add("Exit", OnExit); trayIcon.ContextMenu = cm; trayIcon.Visible = true; }