public override void OnActivate(int pinID) { if (pinID != 0 && pinID != 100) { return; } PlayerData player = MonoSingleton <GameManager> .Instance.Player; this.mItemParam = MonoSingleton <GameManager> .Instance.GetItemParam(GlobalVars.SelectedCreateItemID); if (!player.CheckItemCapacity(this.mItemParam, 1)) { ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(2); } else if (pinID == 0) { if (MonoSingleton <GameManager> .Instance.GetRecipeParam(this.mItemParam.recipe).cost > player.Gold) { ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(3); } else { CreateItemResult result_type = player.CheckCreateItem(this.mItemParam); if (result_type == CreateItemResult.NotEnough) { ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(4); } else if (result_type == CreateItemResult.CanCreateCommon) { int cost = 0; Dictionary <string, int> consumes = (Dictionary <string, int>)null; bool is_ikkatsu = false; NeedEquipItemList item_list = new NeedEquipItemList(); MonoSingleton <GameManager> .GetInstanceDirect().Player.CheckEnableCreateItem(this.mItemParam, ref is_ikkatsu, ref cost, ref consumes, item_list); UIUtility.ConfirmBox(LocalizedText.Get("sys.COMMON_EQUIP_CHECK_MADE", new object[1] { (object)item_list.GetCommonItemListString() }), (UIUtility.DialogResultEvent)(go => this.CallApiNormal(player, result_type)), (UIUtility.DialogResultEvent)null, (GameObject)null, false, -1, (string)null, (string)null); } else { this.CallApiNormal(player, result_type); } } } else { int cost = 0; Dictionary <string, int> consumes = (Dictionary <string, int>)null; bool is_ikkatsu = false; NeedEquipItemList need_euip_item = new NeedEquipItemList(); bool flag = player.CheckEnableCreateItem(this.mItemParam, ref is_ikkatsu, ref cost, ref consumes, need_euip_item); if (cost > player.Gold) { ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(3); } else if (!flag && !need_euip_item.IsEnoughCommon()) { ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(4); } else if (need_euip_item.IsEnoughCommon()) { UIUtility.ConfirmBox(LocalizedText.Get("sys.COMMON_EQUIP_CHECK_ONETAP", new object[1] { (object)need_euip_item.GetCommonItemListString() }), (UIUtility.DialogResultEvent)(go => this.CallApi(need_euip_item, player)), (UIUtility.DialogResultEvent)null, (GameObject)null, false, -1, (string)null, (string)null); } else { this.CallApi(need_euip_item, player); } } }
public bool CheckJobRankUp(UnitData self, bool canCreate = false, bool useCommon = true) { if (this.Param == null || this.Rank >= this.GetJobRankCap(self)) { return(false); } PlayerData player = MonoSingleton <GameManager> .Instance.Player; NeedEquipItemList needEquipItemList = new NeedEquipItemList(); if (canCreate) { if (!player.CheckEnableCreateEquipItemAll(self, this.mEquips, !useCommon ? (NeedEquipItemList)null : needEquipItemList) && !needEquipItemList.IsEnoughCommon()) { return(false); } } else { for (int index = 0; index < 6; ++index) { if (this.mEquips[index] == null || !this.mEquips[index].IsEquiped()) { return(false); } } } return(true); }
public void CallApi(NeedEquipItemList need_euip_item, PlayerData player) { if (Network.Mode == Network.EConnectMode.Online) { this.ExecRequest((WebAPI) new ReqItemCompositAll(this.mItemParam.iname, need_euip_item.IsEnoughCommon(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); ((Behaviour)this).set_enabled(true); } else { player.CreateItemAll(this.mItemParam); } }