void OpenUpgradeWindow(bool with_effect_ = false)
        {
            m_cur_right_type             = ENUM_RIGHT_WINDOW_TYPE.E_UPGRADE;
            this.m_detail_window.Visible = false;
            UIOfficerInfo data = this.GetOfficerData(this.m_currentPageType, this.m_choose_officer_id);

            this.m_upgrade_window.Refresh(data.m_data, PoliceUILogicAssist.GetOfficerServerInfo(data.m_data), with_effect_);
            this.m_upgrade_window.Visible = true;
        }
        void OpenDetailWindow()
        {
            m_cur_right_type = ENUM_RIGHT_WINDOW_TYPE.E_DETAIL;
            this.m_upgrade_window.Visible = false;
            UIOfficerInfo data = this.GetOfficerData(this.m_currentPageType, this.m_choose_officer_id);

            this.m_detail_window.Refresh(data.m_data, PoliceUILogicAssist.GetOfficerServerInfo(data.m_data));
            this.m_detail_window.Visible = true;
        }
Example #3
0
        public void Refresh(ConfOfficer ori_info_, OfficerInfo server_info_)
        {
            this.m_portrait_icon.Sprite = ori_info_.icon;

            long officer_id = null == server_info_ ? ori_info_.id : server_info_.OfficerId;;
            int  lvl        = null == server_info_ ? 0 : server_info_.Level;
            int  outsight   = null == server_info_ ? ori_info_.outsight : server_info_.Outsight;
            int  memory     = null == server_info_ ? ori_info_.memory : server_info_.Memory;
            int  attention  = null == server_info_ ? ori_info_.attention : server_info_.Attention;
            int  willpower  = null == server_info_ ? ori_info_.willpower : server_info_.WillPower;


            m_name_title.Text    = LocalizeModule.Instance.GetString(ori_info_.name);
            m_quality_label.Text = PoliceUILogicAssist.GetQualityString(ori_info_.quality);
            m_lvl_icon.Sprite    = PoliceUILogicAssist.GetPoliceRankIcon(lvl);

            string icon_name, desc;

            if (SkillUtil.GetCurLevelSkillIconAndDesc(officer_id, lvl, out icon_name, out desc))
            {
                if (lvl == 0)
                {
                    this.m_skillLevelLab.Text = "1";
                }
                else
                {
                    this.m_skillLevelLab.Text = lvl.ToString();
                }
                m_skill_icon.Sprite = icon_name;
                m_skill_desc.Text   = desc;
            }

            m_ability_icon.SetPropList(new List <float> {
                outsight, memory, attention, willpower
            });

            m_observe_num.Text   = outsight.ToString();
            m_memory_num.Text    = memory.ToString();
            m_attention_num.Text = attention.ToString();
            m_willpower_num.Text = willpower.ToString();

            List <string> key_words      = PoliceUILogicAssist.GetKeyWords(ori_info_);
            List <string> key_words_icon = PoliceUILogicAssist.GetKeyWordsIcon(ori_info_);

            foreach (var key in m_key_roots)
            {
                key.Visible = false;
            }

            for (int i = 0; i < key_words.Count && i < m_key_labels.Count; ++i)
            {
                m_key_roots[i].Visible = true;
                m_key_labels[i].Text   = key_words[i];
                m_key_icons[i].Sprite  = key_words_icon[i];
            }
        }
Example #4
0
        public void Refresh(long officer_id_)
        {
            m_officer_id = officer_id_;

            ConfOfficer info = ConfOfficer.Get(officer_id_);

            m_head_tex.TextureName = info.portrait;
            m_name_txt.Text        = LocalizeModule.Instance.GetString(info.name);
            m_name_txt.color       = PoliceUILogicAssist.GetPoliceQualityColor(info.quality);
            Occupied(true);
        }
        void OnOpenUpgradeWindow()
        {
            if (this.m_upgrade_window.Visible)
            {
                UIOfficerInfo data = this.GetOfficerData(this.m_currentPageType, this.m_choose_officer_id);
                this.m_upgrade_window.Refresh(data.m_data, PoliceUILogicAssist.GetOfficerServerInfo(data.m_data));
                return;
            }

            this.m_cur_tween_progress = ENUM_TWEEN_PROGRESS.E_DETAIL_TO_UPGRADE;

            this.m_right_window_tween.PlayForward();
        }
        private void RefreshOfficerDatas()
        {
            if (m_data_timestamp == GlobalInfo.MY_PLAYER_INFO.OfficerTimestamp)
            {
                return;
            }
            m_data_timestamp = GlobalInfo.MY_PLAYER_INFO.OfficerTimestamp;

            m_all_officer    = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_ALL);
            m_spcial_polices = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_SPECIAL_POLICE);
            m_patrol_men     = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_PATROL_MEN);
            m_inspectors     = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_INSPECTOR);
            m_baus           = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_BAU);
            m_csis           = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_CSI);
            m_forensics      = PoliceUILogicAssist.GetOfficerByPageType(ENUM_PAGE_TYPE.E_FORENSIC);
        }
        void OnFinishRightWindowTween()
        {
            if (ENUM_TWEEN_PROGRESS.E_UPGRADE_TO_DETAIL == this.m_cur_tween_progress)
            {
                UIOfficerInfo data = this.GetOfficerData(this.m_currentPageType, this.m_choose_officer_id);
                this.m_detail_window.Refresh(data.m_data, PoliceUILogicAssist.GetOfficerServerInfo(data.m_data));
                this.m_upgrade_window.Visible = true;
                this.m_right_window_tween.PlayBackward();
            }
            else if (ENUM_TWEEN_PROGRESS.E_DETAIL_TO_UPGRADE == this.m_cur_tween_progress)
            {
                this.m_detail_window.Visible = true;
                UIOfficerInfo data = this.GetOfficerData(this.m_currentPageType, this.m_choose_officer_id);
                this.m_upgrade_window.Refresh(data.m_data, PoliceUILogicAssist.GetOfficerServerInfo(data.m_data));
                this.m_right_window_tween.PlayBackward();
            }

            this.m_cur_tween_progress = ENUM_TWEEN_PROGRESS.E_INVALID;
        }
        public void Refresh(OfficerInfo info, Action <long> OnSelected_, ENUM_SEARCH_MODE mode_)
        {
            m_info        = info;
            m_on_selected = OnSelected_;

            ConfOfficer officer_data = ConfOfficer.Get(info.OfficerId);

            m_tex.TextureName = officer_data.portrait;
            m_name_txt.Text   = LocalizeModule.Instance.GetString(officer_data.name);
            m_name_txt.color  = PoliceUILogicAssist.GetPoliceQualityColor(officer_data.quality);


            if (ENUM_SEARCH_MODE.E_SEARCH_ROOM == mode_)
            {
                m_skill_root.Visible   = true;
                m_keyword_root.Visible = false;

                m_lvl_icon.Sprite = PoliceUILogicAssist.GetPoliceRankIcon(info.Level);
                string icon, desc;
                if (SkillUtil.GetCurLevelSkillIconAndDesc(info.OfficerId, info.Level, out icon, out desc))
                {
                    m_skill_lvl_txt.Text  = info.Level.ToString();
                    m_skill_icon.Sprite   = icon;
                    m_skill_desc_txt.Text = desc;
                }
            }
            else if (ENUM_SEARCH_MODE.E_EVENTGAME == mode_)
            {
                m_skill_root.Visible   = false;
                m_keyword_root.Visible = true;
                m_lvl_icon.Sprite      = PoliceUILogicAssist.GetPoliceRankIcon(info.Level);
                List <long> keywords_id = EventGameUIAssist.GetPoliceKeyWordByOfficerID(info.OfficerId);
                m_keyword_grid.EnsureSize <EventGameKeywordItemView>(keywords_id.Count);

                for (int i = 0; i < m_keyword_grid.ChildCount; ++i)
                {
                    m_keyword_grid.GetChild <EventGameKeywordItemView>(i).Refresh(i, keywords_id[i]);
                    m_keyword_grid.GetChild <EventGameKeywordItemView>(i).Visible = true;
                }
            }
        }
Example #9
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);
        }
Example #10
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);
            }
        }