private void OnLevelBtn() { ITable table = dbReference[refUpgType.ID]; ITableData needInfo = table[refUpgType.Level - 1]; #region old //string jsonData = table[refUpgType.Level - 1].ToJSON(); //// GenericUpgradeInfo needInfo = JsonUtility.FromJson<GenericUpgradeInfo>(jsonData); #endregion int foodCost = GetPublicValue <int>(needInfo, "FoodCost"); int woodCost = GetPublicValue <int>(needInfo, "WoodCost"); int metalCost = GetPublicValue <int>(needInfo, "MetalCost"); int stoneCost = GetPublicValue <int>(needInfo, "StoneCost"); int timeInt = GetPublicValue <int>(needInfo, "TimeInt"); currentMainBase.Farm -= foodCost; // needInfo.FoodCost; currentMainBase.Wood -= woodCost; //needInfo.WoodCost; currentMainBase.Metal -= metalCost; // needInfo.MetalCost; currentMainBase.Stone -= stoneCost; // needInfo.StoneCost; currentMainBase.UpgradeWait_ID = refUpgType.ID; currentMainBase.SetUpgradeTime(timeInt); // needInfo.TimeInt; listenersController.Emit("S_UPGRADE"); Group.Close(); }
private void OnAccept() { if (CheckEnoughtResource()) { SyncData.CurrentMainBase.Farm -= refCostInfo.FoodCost * quality; SyncData.CurrentMainBase.Wood -= refCostInfo.WoodCost * quality; SyncData.CurrentMainBase.Stone -= refCostInfo.StoneCost * quality; SyncData.CurrentMainBase.Metal -= refCostInfo.MetalCost * quality; int trainingMight = fieldReflection.GetPublicField <int>(refTypeTraining, "MightBonus") * quality; int trainingTime = fieldReflection.GetPublicField <int>(refTypeTraining, "TrainingTime") * quality; SyncData.CurrentMainBase.SetTrainingTime(trainingTime); SyncData.CurrentMainBase.Training_Might = trainingMight; SyncData.CurrentMainBase.TrainingUnit_ID = selectedType; SyncData.CurrentMainBase.TrainingQuality = quality; Close(); listenersController.Emit("S_TRAINING"); } }
private void Start() { Events.Emit("S_UNIT"); FriendSystem.Register(this); }