public SquadServerManager(SquadController controller) { this.controller = controller; this.notifAdapter = new SquadNotifAdapter(); this.chatAdapter = new ChatServerAdapter(); this.callbacks = new List <SquadController.SquadMsgsCallback>(); }
public SquadMsgManager(SquadController controller) { this.controller = controller; this.msgs = new List <SquadMsg>(); this.msgsByIds = new Dictionary <string, SquadMsg>(); this.observers = new List <ISquadMsgDisplay>(); this.msgsToProcess = new List <SquadMsg>(); this.linkedMsgs = new Dictionary <string, List <SquadMsg> >(); }
public void SendTroopRequest(string requestText, bool isWarRequest = false) { bool flag = true; bool payToSkip = false; uint serverTime = Service.ServerAPI.ServerTime; SquadController squadController = Service.SquadController; uint troopRequestDate; if (isWarRequest) { troopRequestDate = squadController.StateManager.WarTroopRequestDate; } else { troopRequestDate = squadController.StateManager.TroopRequestDate; } int troopRequestCrystalCost = SquadUtils.GetTroopRequestCrystalCost(serverTime, troopRequestDate); if (troopRequestCrystalCost > 0) { payToSkip = true; flag = GameUtils.SpendCrystals(troopRequestCrystalCost); } if (flag) { string empty = string.Empty; string itemId = "requestTroops"; int itemCount = 1; string type = "squad_action"; string subType = "consumable"; Service.DMOAnalyticsController.LogInAppCurrencyAction(-troopRequestCrystalCost, empty, itemId, itemCount, type, subType); if (string.IsNullOrEmpty(requestText)) { if (isWarRequest) { requestText = Service.Lang.Get("REQUEST_WAR_TROOPS_DEFAULT", new object[0]); } else { requestText = Service.Lang.Get("REQUEST_TROOPS_DEFAULT", new object[0]); } } SquadMsg message; if (isWarRequest) { message = SquadMsgUtils.CreateRequestWarTroopsMessage(payToSkip, troopRequestCrystalCost, requestText); Service.EventManager.SendEvent(EventId.SquadWarTroopsRequestStartedByCurrentPlayer, null); } else { message = SquadMsgUtils.CreateRequestTroopsMessage(payToSkip, troopRequestCrystalCost, requestText); } this.TakeAction(message); } Service.EventManager.SendEvent(EventId.SquadEdited, null); }
public void Destroy() { this.ClearAllMsgs(); this.controller = null; this.msgs = null; this.msgsByIds = null; this.observers.Clear(); this.observers = null; this.msgsToProcess = null; this.linkedMsgs = null; }