Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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 static bool GetConfig(string fieldName, object fieldValue, out ConfCombineFormula config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_CombineFormula", fieldName, fieldValue);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        config = null;
                        return(false);
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("CombineFormula 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 public void RefreshCombinedPropCount(long combine_id_)
 {
     if (m_cur_combine_id == combine_id_)
     {
         var combine = ConfCombineFormula.Get(combine_id_);
         RefreshCombineProp(combine);
     }
 }
        private static ConfCombineFormula GetConfByDic(DataTable reader)
        {
            long   id             = reader.GetInt64(0);
            int    mixLimit       = reader.GetInt32(1);
            long   dropGroupId    = reader.GetInt64(2);
            int    serialNumber   = reader.GetInt32(3);
            int    outputCount    = reader.GetInt32(4);
            long   outputId       = reader.GetInt64(5);
            int    rate           = reader.GetInt32(6);
            int    type           = reader.GetInt32(7);
            int    special4Count  = reader.GetInt32(8);
            long   specialPropId4 = reader.GetInt64(9);
            int    special3Count  = reader.GetInt32(10);
            long   specialPropId3 = reader.GetInt64(11);
            int    special2Count  = reader.GetInt32(12);
            long   specialPropId2 = reader.GetInt64(13);
            int    special1Count  = reader.GetInt32(14);
            long   specialPropId1 = reader.GetInt64(15);
            long   propId6        = reader.GetInt64(16);
            long   propId5        = reader.GetInt64(17);
            long   propId4        = reader.GetInt64(18);
            long   propId3        = reader.GetInt64(19);
            long   propId2        = reader.GetInt64(20);
            long   propId1        = reader.GetInt64(21);
            string descs          = reader.GetString(22);
            string name           = reader.GetString(23);

            ConfCombineFormula new_obj_ConfCombineFormula = new ConfCombineFormula(id,
                                                                                   mixLimit,
                                                                                   dropGroupId,
                                                                                   serialNumber,
                                                                                   outputCount,
                                                                                   outputId,
                                                                                   rate,
                                                                                   type,
                                                                                   special4Count,
                                                                                   specialPropId4,
                                                                                   special3Count,
                                                                                   specialPropId3,
                                                                                   special2Count,
                                                                                   specialPropId2,
                                                                                   special1Count,
                                                                                   specialPropId1,
                                                                                   propId6,
                                                                                   propId5,
                                                                                   propId4,
                                                                                   propId3,
                                                                                   propId2,
                                                                                   propId1,
                                                                                   descs,
                                                                                   name
                                                                                   );

            return(new_obj_ConfCombineFormula);
        }
Esempio n. 8
0
        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);
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_CombineFormula");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfCombineFormula _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.id] = _conf;
             }
             resLoaded = true;
         }
     }
 }
Esempio n. 11
0
        public static bool GetConfig(long id, out ConfCombineFormula config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_CombineFormula", id);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        dic[id] = null;
                        config  = null;
                        return(false);
                    }
                    dic[id] = config;
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("CombineFormula 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }
Esempio n. 12
0
        void RefreshCombineProp(ConfCombineFormula combine)
        {
            m_cur_mix_num       = CombineDataManager.Instance.GetCurCount(m_cur_combine_id);
            m_progress_txt.Text = 0 == combine.mixLimit ? "" : $"{m_cur_mix_num}/{combine.mixLimit}";

            int sum = 0;

            sum += RefreshBigStuffs(m_cur_combine_id) ? 1 : 0;
            sum += RefreshSmallStuffs(m_cur_combine_id) ? 1 : 0;

            m_stored_img.Visible  = false;
            m_combine_btn.Visible = true;
            m_gift_btn.Visible    = true;
            if (sum >= 2 && (0 == combine.mixLimit || m_cur_mix_num < combine.mixLimit))
            {
                m_combine_btn.Enable = true;
                m_combine_btn.SetGray(false);
            }
            else
            {
                if ((int)ENUM_COMBINE_TYPE.COLLECTION == combine.type)
                {
                    if (sum < 2)
                    {
                        m_combine_btn.Enable = false;
                        m_combine_btn.SetGray(true);
                    }
                    else
                    {
                        m_stored_img.Visible  = true;
                        m_combine_btn.Visible = false;
                    }
                }
                else
                {
                    m_combine_btn.Enable = false;
                    m_combine_btn.SetGray(true);
                }
            }
        }
        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);
        }
Esempio n. 14
0
        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;
            }
        }
Esempio n. 15
0
 public static void Register()
 {
     ConfAchievement.Init();
     ConfActiveDrop.Init();
     ConfActivityBase.Init();
     ConfAssetManifest.Init();
     Confbranchtask.Init();
     ConfBuilding.Init();
     ConfCartoonScene.Init();
     ConfChapter.Init();
     ConfCharge.Init();
     ConfChat.Init();
     ConfChatItem.Init();
     ConfCheckIn.Init();
     ConfCombineFormula.Init();
     ConfDemoScene.Init();
     ConfDropOut.Init();
     ConfPropGiftItem0.Init();
     ConfPropGiftItem1.Init();
     ConfPropGiftItem2.Init();
     ConfDropOut2.Init();
     Confetl.Init();
     ConfEvent.Init();
     ConfEventAttribute.Init();
     ConfEventPhase.Init();
     Confexhibit.Init();
     ConfExpToLevel.Init();
     Conffailtips.Init();
     ConfFeedback.Init();
     ConfFind.Init();
     ConfFindClue.Init();
     ConfFindTypeIcon.Init();
     ConfGMCMD.Init();
     ConfGuid.Init();
     ConfGuidArt.Init();
     ConfGuidNew.Init();
     ConfGuidNewFunction.Init();
     Confinapppurchase.Init();
     ConfJigsawScene.Init();
     ConfKeyWords.Init();
     ConfLanguage.Init();
     ConfMsgCode.Init();
     ConfNode.Init();
     ConfNpc.Init();
     ConfOfficer.Init();
     ConfPath.Init();
     ConfPoliceRankIcon.Init();
     ConfProp.Init();
     ConfPropGift.Init();
     ConfPropGiftItem0.Init();
     ConfPropGiftItem1.Init();
     ConfPropGiftItem2.Init();
     ConfPush.Init();
     ConfReasoning.Init();
     ConfScene.Init();
     ConfSceneDifficulty.Init();
     ConfSceneSpecial.Init();
     ConfServiceConfig.Init();
     ConfSkill.Init();
     ConfSkyEye.Init();
     ConfSound.Init();
     ConfTask.Init();
     ConfTitle.Init();
 }
Esempio n. 16
0
        public void Refresh(ConfOfficer ori_info_, OfficerInfo server_info_ = null, bool with_effect_ = false)
        {
            m_body_tex.TextureName = ori_info_.portrait;
            m_body_tex.SetGray(false);
            this.m_officer_id        = ori_info_.id;
            this.m_officer_server_id = null == server_info_ ? -1 : server_info_.PlayerOfficerId;

            int lvl = null == server_info_ ? 0 : server_info_.Level;

            m_level_icon.Sprite = PoliceUILogicAssist.GetPoliceRankIcon(lvl);
            m_name_title.Text   = LocalizeModule.Instance.GetString(ori_info_.name);

            ConfCombineFormula next_level_combine_info = PoliceUILogicAssist.GetCombineInfo(ori_info_, lvl + 1);

            if (null != next_level_combine_info)
            {
                //tool
                List <string> tool_icon_names = new List <string>();
                tool_icon_names.Add(ConfProp.Get(next_level_combine_info.propId1).icon);
                tool_icon_names.Add(ConfProp.Get(next_level_combine_info.propId2).icon);
                tool_icon_names.Add(ConfProp.Get(next_level_combine_info.propId3).icon);
                tool_icon_names.Add(ConfProp.Get(next_level_combine_info.propId4).icon);
                tool_icon_names.Add(ConfProp.Get(next_level_combine_info.propId5).icon);

                List <long> tool_ids = new List <long>();
                tool_ids.Add(next_level_combine_info.propId1);
                tool_ids.Add(next_level_combine_info.propId2);
                tool_ids.Add(next_level_combine_info.propId3);
                tool_ids.Add(next_level_combine_info.propId4);
                tool_ids.Add(next_level_combine_info.propId5);

                bool lock_officer = false;

                for (int i = 0; i < m_tool_icons.Count; ++i)
                {
                    bool disable = !GlobalInfo.MY_PLAYER_INFO.Bag_infos.ContainsKey(tool_ids[i]);
                    if (disable)
                    {
                        lock_officer = true;
                    }
                    m_tool_icons[i].Refresh(tool_icon_names[i], disable);
                }

                ToolData t_d1 = new ToolData
                {
                    m_tool_id        = next_level_combine_info.propId1,
                    m_tool_count     = GlobalInfo.MY_PLAYER_INFO.Bag_infos.ContainsKey(next_level_combine_info.propId1) ? GlobalInfo.MY_PLAYER_INFO.Bag_infos[next_level_combine_info.propId1].Count : 0,
                    m_tool_max_count = 1
                };

                ToolData t_d2 = new ToolData
                {
                    m_tool_id        = next_level_combine_info.propId2,
                    m_tool_count     = GlobalInfo.MY_PLAYER_INFO.Bag_infos.ContainsKey(next_level_combine_info.propId2) ? GlobalInfo.MY_PLAYER_INFO.Bag_infos[next_level_combine_info.propId2].Count : 0,
                    m_tool_max_count = 1
                };
                ToolData t_d3 = new ToolData
                {
                    m_tool_id        = next_level_combine_info.propId3,
                    m_tool_count     = GlobalInfo.MY_PLAYER_INFO.Bag_infos.ContainsKey(next_level_combine_info.propId3) ? GlobalInfo.MY_PLAYER_INFO.Bag_infos[next_level_combine_info.propId3].Count : 0,
                    m_tool_max_count = 1
                };
                ToolData t_d4 = new ToolData
                {
                    m_tool_id        = next_level_combine_info.propId4,
                    m_tool_count     = GlobalInfo.MY_PLAYER_INFO.Bag_infos.ContainsKey(next_level_combine_info.propId4) ? GlobalInfo.MY_PLAYER_INFO.Bag_infos[next_level_combine_info.propId4].Count : 0,
                    m_tool_max_count = 1
                };
                ToolData t_d5 = new ToolData
                {
                    m_tool_id        = next_level_combine_info.propId5,
                    m_tool_count     = GlobalInfo.MY_PLAYER_INFO.Bag_infos.ContainsKey(next_level_combine_info.propId5) ? GlobalInfo.MY_PLAYER_INFO.Bag_infos[next_level_combine_info.propId5].Count : 0,
                    m_tool_max_count = 1
                };
                m_tool_datas = new List <ToolData>()
                {
                    t_d1,
                    t_d2,
                    t_d3,
                    t_d4,
                    t_d5
                };



                //item
                List <string> item_icon_names = new List <string>();
                item_icon_names.Add(ConfProp.Get(next_level_combine_info.specialPropId1).icon);
                item_icon_names.Add(ConfProp.Get(next_level_combine_info.specialPropId2).icon);
                item_icon_names.Add(ConfProp.Get(next_level_combine_info.specialPropId3).icon);
                item_icon_names.Add(ConfProp.Get(next_level_combine_info.specialPropId4).icon);

                List <long> item_ids = new List <long>();
                item_ids.Add(next_level_combine_info.specialPropId1);
                item_ids.Add(next_level_combine_info.specialPropId2);
                item_ids.Add(next_level_combine_info.specialPropId3);
                item_ids.Add(next_level_combine_info.specialPropId4);

                List <int> item_nums = new List <int>();
                item_nums.Add(next_level_combine_info.special1Count);
                item_nums.Add(next_level_combine_info.special2Count);
                item_nums.Add(next_level_combine_info.special3Count);
                item_nums.Add(next_level_combine_info.special4Count);

                m_item_datas = new List <ToolData>();

                for (int i = 0; i < item_ids.Count; ++i)
                {
                    m_items[i].Sprite          = item_icon_names[i];
                    m_items[i].gameObject.name = i.ToString();

                    PlayerPropMsg cur_item_in_bag;
                    int           cur_num = 0;
                    if (GlobalInfo.MY_PLAYER_INFO.Bag_infos.TryGetValue(item_ids[i], out cur_item_in_bag))
                    {
                        cur_num = cur_item_in_bag.Count;
                    }
                    m_items_nums[i].Text           = cur_num.ToString();
                    m_items_max_nums[i].Text       = item_nums[i].ToString();
                    m_item_progress[i].FillAmmount = (float)(((float)cur_num) / item_nums[i]);

                    if (cur_num < item_nums[i])
                    {
                        lock_officer = true;
                    }

                    ToolData t_d = new ToolData
                    {
                        m_tool_id        = item_ids[i],
                        m_tool_count     = cur_num,
                        m_tool_max_count = item_nums[i]
                    };

                    m_item_datas.Add(t_d);
                }

                if (0 == lvl)
                {
                    if (!lock_officer)
                    //   this.m_employ_btn.Visible = true;
                    {
                        SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_EMPLOY_ENABLE);
                    }
                    else
                    //this.m_employ_btn.Visible = false;
                    {
                        //TimeModule.Instance.SetTimeout(() => SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_EMPLOY_DISABLE), 0.5f);
                        SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_EMPLOY_DISABLE);
                    }

                    this.m_upgrade_btn.Visible = false;
                    m_body_tex.SetGray(true);
                }
                else
                {
                    if (!lock_officer)
                    {
                        //this.m_upgrade_btn.Visible = true;
                        SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_UPGRADE_ENABLE);
                    }
                    else
                    {
                        //this.m_upgrade_btn.Visible = false;
                        //TimeModule.Instance.SetTimeout(() => SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_UPGRADE_DISABLE), 0.5f);
                        SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_UPGRADE_DISABLE);
                    }
                }

                m_tool_icons.ForEach((tool) => { tool.Visible = true; });
                m_item_roots.ForEach((tool) => { tool.Visible = true; });
            }
            else
            {
                m_tool_icons.ForEach((tool) => { tool.Visible = false; });
                m_item_roots.ForEach((tool) => { tool.Visible = false; });


                this.SwitchUpgradAndEmployBtn(ENUM_BTN_TYPE.E_ALL_DISABLE);
            }


            if (with_effect_)
            {
                ShowUpgradeEffect(lvl);
            }
        }
Esempio n. 17
0
        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);
            }
        }
Esempio n. 18
0
        void LeftToggleChecked(bool v_, int i_)
        {
            if (v_)
            {
                m_combine_type = (ENUM_COMBINE_TYPE)i_;

                SwitchOutputView(m_combine_type);
                List <ConfCombineFormula> combine_datas = ConfCombineFormula.array.Where((e) => e.type == i_).OrderBy(e => e.id).ToList();

                m_top_toggle_grid.EnsureSize <ToggleCheckMarkView>(combine_datas.Count());

                if (0 == combine_datas.Count())
                {
                    NoneItems();
                    return;
                }

                if (0 != m_fixed_prop_id)
                {
                    RefreshTopToggleByFixedID();
                    //m_fixed_prop_id = 0;
                }

                if (0 != m_fixed_combine_id)
                {
                    int move_count = 0;

                    for (int i = 0; i < m_top_toggle_grid.ChildCount; ++i)
                    {
                        ConfCombineFormula  data    = combine_datas[i];
                        ToggleCheckMarkView element = m_top_toggle_grid.GetChild <ToggleCheckMarkView>(i);
                        element.Visible = false;
                        element.Visible = true;
                        string icon_name = GetOutputIcon(data.id);

                        if (data.id == m_fixed_combine_id)
                        {
                            move_count = i;
                        }

                        element.Refresh(data.id, null != icon_name ? icon_name : "BaoLuoGongZuoShi_01_bangqiushoutao_01.png", data.id == m_fixed_combine_id, TopToggleChecked);
                    }


                    //m_drop_scroll.scrollView.horizontal = false;

                    float from_x = m_drop_grid_ori_local_x - (m_drop_item_size_x + m_drop_item_space_x) * move_count;
                    m_top_toggle_grid.gameObject.transform.localPosition = new Vector3(from_x, m_top_toggle_grid.gameObject.transform.localPosition.y, m_top_toggle_grid.gameObject.transform.localPosition.z);

                    //m_fixed_combine_id = 0;
                }
                else
                {
                    for (int i = 0; i < m_top_toggle_grid.ChildCount; ++i)
                    {
                        ConfCombineFormula  data    = combine_datas[i];
                        ToggleCheckMarkView element = m_top_toggle_grid.GetChild <ToggleCheckMarkView>(i);
                        element.Visible = false;
                        element.Visible = true;
                        string icon_name = GetOutputIcon(data.id);

                        element.Refresh(data.id, null != icon_name ? icon_name : "BaoLuoGongZuoShi_01_bangqiushoutao_01.png", i == 0, TopToggleChecked);
                    }
                }
            }
        }
Esempio n. 19
0
        private bool IsThisOfficerCouldCombine(ConfOfficer officer_, Dictionary <long, OfficerInfo> my_combined_officers, Dictionary <long, int> all_item_in_bag_)
        {
            ConfOfficer item = officer_;

            long id  = item.id;
            int  lvl = 0;

            if (my_combined_officers.ContainsKey(id))
            {
                lvl = my_combined_officers[id].Level;
            }

            ConfCombineFormula next_level_combine_info = PoliceUILogicAssist.GetCombineInfo(item, lvl + 1);

            if (null == next_level_combine_info)
            {
                return(false);
            }

            if (!all_item_in_bag_.ContainsKey(next_level_combine_info.propId1) || !all_item_in_bag_.ContainsKey(next_level_combine_info.propId2) ||
                !all_item_in_bag_.ContainsKey(next_level_combine_info.propId3) || !all_item_in_bag_.ContainsKey(next_level_combine_info.propId4) ||
                !all_item_in_bag_.ContainsKey(next_level_combine_info.propId5) || !all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId1) ||
                !all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId2) || !all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId3) ||
                !all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId4))
            {
                //if (!bag_items.ContainsKey(next_level_combine_info.propId1) || !bag_items.ContainsKey(next_level_combine_info.propId2)
                // || !bag_items.ContainsKey(next_level_combine_info.propId3) || !bag_items.ContainsKey(next_level_combine_info.propId4)
                // || !bag_items.ContainsKey(next_level_combine_info.propId5) || !bag_items.ContainsKey(next_level_combine_info.specialPropId1)
                // || !bag_items.ContainsKey(next_level_combine_info.specialPropId2) || !bag_items.ContainsKey(next_level_combine_info.specialPropId3)
                // || !bag_items.ContainsKey(next_level_combine_info.specialPropId4))
                //{
                return(false);
                //}
            }

            //int s_id1_in_bag_count = bag_items.ContainsKey(next_level_combine_info.specialPropId1) ? bag_items[next_level_combine_info.specialPropId1].Count : 0;
            //int s_id2_in_bag_count = bag_items.ContainsKey(next_level_combine_info.specialPropId2) ? bag_items[next_level_combine_info.specialPropId2].Count : 0;
            //int s_id3_in_bag_count = bag_items.ContainsKey(next_level_combine_info.specialPropId3) ? bag_items[next_level_combine_info.specialPropId3].Count : 0;
            //int s_id4_in_bag_count = bag_items.ContainsKey(next_level_combine_info.specialPropId4) ? bag_items[next_level_combine_info.specialPropId4].Count : 0;

            int s_id1_in_add_count = all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId1) ? all_item_in_bag_[next_level_combine_info.specialPropId1] : 0;
            int s_id2_in_add_count = all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId2) ? all_item_in_bag_[next_level_combine_info.specialPropId2] : 0;
            int s_id3_in_add_count = all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId3) ? all_item_in_bag_[next_level_combine_info.specialPropId3] : 0;
            int s_id4_in_add_count = all_item_in_bag_.ContainsKey(next_level_combine_info.specialPropId4) ? all_item_in_bag_[next_level_combine_info.specialPropId4] : 0;


            //if (s_id1_in_bag_count + s_id1_in_add_count < next_level_combine_info.special1Count
            //    || s_id2_in_bag_count + s_id2_in_add_count < next_level_combine_info.special2Count
            //    || s_id3_in_bag_count + s_id3_in_add_count < next_level_combine_info.special3Count
            //    || s_id4_in_bag_count + s_id4_in_add_count < next_level_combine_info.special4Count)
            if (s_id1_in_add_count < next_level_combine_info.special1Count ||
                s_id2_in_add_count < next_level_combine_info.special2Count ||
                s_id3_in_add_count < next_level_combine_info.special3Count ||
                s_id4_in_add_count < next_level_combine_info.special4Count)

            {
                return(false);
            }

            //if (bag_items[next_level_combine_info.specialPropId1].Count < next_level_combine_info.special1Count
            //|| bag_items[next_level_combine_info.specialPropId2].Count < next_level_combine_info.special2Count
            //|| bag_items[next_level_combine_info.specialPropId3].Count < next_level_combine_info.special3Count
            //|| bag_items[next_level_combine_info.specialPropId4].Count < next_level_combine_info.special4Count)
            //{

            //    continue;
            //}

            return(true);
        }
Esempio n. 20
0
        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)
                //{
                //    //物件,进储藏室

                //}
            }
        }