bool RefreshBigStuffs(long id_) { ConfCombineFormula data = ConfCombineFormula.Get(id_); long[] big_props = new long[] { data.propId1, data.propId2, data.propId3, data.propId4, data.propId5, data.propId6 }; int sum = 0; PlayerPropMsg prop_info; bool have; int num; for (int i = 0; i < big_props.Length; ++i) { if (0 == big_props[i]) { m_big_stuffs[i].Visible = false; sum += 1; continue; } prop_info = GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(big_props[i]); have = null != prop_info ? true : false; sum += have ? 1 : 0; num = have ? prop_info.Count : 0; m_big_stuffs[i].Refresh(big_props[i], num, ConfProp.Get(big_props[i]).icon, have); m_big_stuffs[i].Visible = true; } return(sum >= 6); }
bool RefreshSmallStuffs(long id_) { ConfCombineFormula data = ConfCombineFormula.Get(id_); long[] special_props = new long[] { data.specialPropId1, data.specialPropId2, data.specialPropId3, data.specialPropId4 }; int[] special_needs = new int[] { data.special1Count, data.special2Count, data.special3Count, data.special4Count }; int sum = 0; int?cur_num; int need_num; for (int i = 0; i < special_props.Length; ++i) { if (0 == special_props[i]) { m_small_stuffs[i].Visible = false; sum += 1; continue; } cur_num = GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(special_props[i])?.Count; need_num = special_needs[i]; sum += cur_num.GetValueOrDefault() >= need_num ? 1 : 0; m_small_stuffs[i].Refresh(special_props[i], ConfProp.Get(special_props[i]).icon, cur_num.GetValueOrDefault(), need_num); m_small_stuffs[i].Visible = true; } return(sum >= 4); }
void RefreshProps(long id_) { ConfCombineFormula data = ConfCombineFormula.Get(id_); m_combine_name_txt.Text = LocalizeModule.Instance.GetString(data.name); long[] big_props = new long[] { data.propId1, data.propId2, data.propId3, data.propId4, data.propId5, data.propId6 }; PlayerPropMsg prop_info; bool have; int num; for (int i = 0; i < big_props.Length; ++i) { if (0 == big_props[i]) { continue; } prop_info = GlobalInfo.MY_PLAYER_INFO.GetBagInfosByID(big_props[i]); have = null != prop_info ? true : false; num = have ? prop_info.Count : 0; m_big_stuffs[i].Refresh(big_props[i], num, ConfProp.Get(big_props[i]).icon, have); } }
string GetOutputIcon(long combine_id_) { ConfCombineFormula data = ConfCombineFormula.Get(combine_id_); long out_put_id = data.outputId; if (0 == out_put_id) { return(null); } switch ((ENUM_COMBINE_TYPE)data.type) { case ENUM_COMBINE_TYPE.POLICE: { return(ConfOfficer.Get(ConfProp.Get(out_put_id).officerId).icon); } case ENUM_COMBINE_TYPE.COLLECTION: case ENUM_COMBINE_TYPE.OTHER: { return(ConfProp.Get(out_put_id).icon); } default: break; } return(null); }
public void RefreshCombinedPropCount(long combine_id_) { if (m_cur_combine_id == combine_id_) { var combine = ConfCombineFormula.Get(combine_id_); RefreshCombineProp(combine); } }
void TopToggleChecked(bool v_, long i_) { if (v_) { m_cur_combine_id = i_; ShowOutputContent(m_cur_combine_id); ConfCombineFormula combine = ConfCombineFormula.Get(m_cur_combine_id); m_name_txt.Text = LocalizeModule.Instance.GetString(combine.name); m_No_txt.Text = $"NO.{combine.id}"; RefreshCombineProp(combine); } }
public void ShowGift(long combine_id_) { long gift_id = ConfCombineFormula.Get(combine_id_).dropGroupId; long drop_id = ConfProp.Get(gift_id).dropout; List <DropOutJsonData> datas = CommonHelper.GetFixedDropOuts(drop_id); var props = from data in datas select new CombineGiftData() { m_id = data.value, m_num = data.count }; m_gift_view.Visible = true; m_gift_view.Refresh(props); }
public static ConfCombineFormula GetCombineInfo(ConfOfficer ori_officer_, int lvl_) { switch (lvl_) { case 1: return(ConfCombineFormula.Get(ori_officer_.unlockFormula)); case 2: return(ConfCombineFormula.Get(ori_officer_.up2Formula)); case 3: return(ConfCombineFormula.Get(ori_officer_.up3Formula)); case 4: return(ConfCombineFormula.Get(ori_officer_.up4Formula)); case 5: return(ConfCombineFormula.Get(ori_officer_.up5Formula)); case 6: return(ConfCombineFormula.Get(ori_officer_.up6Formula)); case 7: return(ConfCombineFormula.Get(ori_officer_.up7Formula)); case 8: return(ConfCombineFormula.Get(ori_officer_.up8Formula)); case 9: return(ConfCombineFormula.Get(ori_officer_.up9Formula)); case 10: return(ConfCombineFormula.Get(ori_officer_.up10Formula)); } return(null); }
void ShowOutputContent(long combine_id_) { long out_put_id = ConfCombineFormula.Get(combine_id_).outputId; if (0 == out_put_id) { return; } switch (m_combine_type) { case ENUM_COMBINE_TYPE.POLICE: { m_tex_view.TextureName = ConfOfficer.Get(ConfProp.Get(out_put_id).officerId).hollowPortrait; } break; case ENUM_COMBINE_TYPE.COLLECTION: { m_3D_view.Refresh(ConfProp.Get(out_put_id).exhibit); //m_3D_view.Refresh(Confexhibit.Get(out_put_id).assetName); //int ret = UnityEngine.Random.Range(1, 3); //m_3D_view.Refresh(0 == ret % 2 ? "FaYuanWai_01_MoTuoChe_01.prefab" : "G_BaoLuoGongZuoShi_01_gangtiexia_01.prefab"); } break; case ENUM_COMBINE_TYPE.OTHER: { m_icon_view.Sprite = ConfProp.Get(out_put_id).icon; } break; default: break; } }
private void OnRes(object obj) { if (obj is SCChatFinishResponse) { SCChatFinishResponse res = (SCChatFinishResponse)obj; if (res.Status == null) { var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSChatFinishRequest req_msg = req as CSChatFinishRequest; long chat_id = req_msg.ChatId; foreach (var task in m_currentTaskList) { NormalTask taskInfo = task as NormalTask; if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count) { continue; } TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; if (TaskCompleteMode.CompletedByDialog != taskCompleteAttribute.CompleteMode) { continue; } long task_dialog_id = (long)taskCompleteCondition.TaskCompleteData; if (chat_id != task_dialog_id) { continue; } taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED; } GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count); } } else if (obj is SCCombineResponse) { SCCombineResponse res = (SCCombineResponse)obj; if (res.Success) { var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSCombineRequest req_msg = req as CSCombineRequest; long combine_id = req_msg.CombineId; long prop_id = ConfCombineFormula.Get(combine_id).outputId; bool tsk_finished = false; foreach (var task in m_currentTaskList) { NormalTask taskInfo = task as NormalTask; if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count) { continue; } TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; if (TaskCompleteMode.CompleteByCombinePropID != taskCompleteAttribute.CompleteMode) { continue; } long[] all_tsk_combine_prop_id = (long[])taskCompleteCondition.TaskCompleteData; if (0 == all_tsk_combine_prop_id.Length) { Debug.LogError($"合成任务{taskInfo.TaskConfID}没有配置完成物件"); continue; } long task_combine_prop_id = all_tsk_combine_prop_id[0]; if (prop_id != task_combine_prop_id) { continue; } tsk_finished = true; taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED; } if (tsk_finished) { GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count); EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_COMBINE); } } } else if (obj is SCCartoonEnterResponse) { SCCartoonEnterResponse res = obj as SCCartoonEnterResponse; if (!MsgStatusCodeUtil.OnError(res.Result)) { var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSCartoonEnterRequest req_msg = req as CSCartoonEnterRequest; long cur_scene_id = req_msg.SceneId; foreach (var task in m_currentTaskList) { NormalTask taskInfo = task as NormalTask; if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count) { continue; } TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0]; TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute; if (TaskCompleteMode.CompletedBySceneID != taskCompleteAttribute.CompleteMode) { continue; } long scene_id = (long)taskCompleteCondition.TaskCompleteData; if (CommonData.C_CARTOON_SCENE_START_ID != scene_id / CommonData.C_SCENE_TYPE_ID) { continue; } if (cur_scene_id != scene_id) { continue; } taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED; } } } else if (obj is SCCartoonRewardReqsponse) { GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count); } }
void OnScResponse(object s) { if (s is SCCombineInfoResponse) { var rsp = s as SCCombineInfoResponse; m_dict.Clear(); var combine_ids = from id in rsp.CombineId select id; var combine_ids_list = combine_ids.ToList(); var cur_counts = from count in rsp.Count select count; var cur_counts_list = cur_counts.ToList(); for (int i = 0; i < combine_ids_list.Count() && i < cur_counts_list.Count(); ++i) { m_dict.Add(combine_ids_list[i], cur_counts_list[i]); } } else if (s is SCCombineResponse) { var rsp = s as SCCombineResponse; if (MsgStatusCodeUtil.OnError(rsp.Result)) { return; } if (false == rsp.Success) { return; } var raw_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke(); CSCombineRequest req = raw_req as CSCombineRequest; if (0 != ConfCombineFormula.Get(req.CombineId).mixLimit) { AddCurCount(req.CombineId); } var combine = ConfCombineFormula.Get(req.CombineId); GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(combine.outputId, combine.outputCount); GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke(); //扣除合成消耗的材料 GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId1); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId2); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId3); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId4); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId5); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId1, combine.special1Count); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId2, combine.special2Count); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId3, combine.special3Count); GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId4, combine.special4Count); //if (ENUM_COMBINE_TYPE.POLICE == (ENUM_COMBINE_TYPE)combine.type) //{ // //出勤卡,进背包 //} //else if (ENUM_COMBINE_TYPE.OTHER == (ENUM_COMBINE_TYPE)combine.type) //{ // //道具,进背包 // GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(combine.outputId, combine.outputCount); //} //else if (ENUM_COMBINE_TYPE.COLLECTION == (ENUM_COMBINE_TYPE)combine.type) //{ // //物件,进储藏室 //} } }