Пример #1
0
        public static int GetTitleVitReduce(long title_id_)
        {
            if (0 == title_id_)
            {
                return(0);
            }

            ConfTitle title = ConfTitle.Get(title_id_);

            if (null == title)
            {
                return(0);
            }

            string benifit = title.benefit;

            List <TitleBenifitData> benifits = JsonSerializer.Deserialize <List <TitleBenifitData> >(benifit);

            foreach (var item in benifits)
            {
                if (2 == int.Parse(item.type))
                {
                    return(Math.Abs(int.Parse(item.value)));
                }
            }

            return(0);
        }
Пример #2
0
        public void Refresh(FriendGift g_info_)
        {
            m_gift_id = g_info_.GiftId;

            PlayerFriendMsg info_ = g_info_.PlayerFriends;

            m_name_text.Text = info_.Name;

            ConfTitle my_title = ConfTitle.Get(info_.TitleId);

            m_title_text.Text = null != my_title?LocalizeModule.Instance.GetString(my_title.name) : "";

            if (info_.Icon.Contains("http://"))
            {
                m_head_icon.Visible    = false;
                m_head_tex.Visible     = true;
                m_head_tex.TextureName = info_.Icon;
            }
            else
            {
                m_head_icon.Visible = true;
                m_head_tex.Visible  = false;
                m_head_icon.Sprite  = info_.Icon;
            }
            //m_gender_icon.Sprite = CommonTools.GetGenderIcon(info_.Gender);
            m_lvl_text.Text = string.Format("LV{0}", info_.Level);


            m_receive_gift_btn.Enable = FriendDataManager.Instance.Receive_gift_left_num > 0;
            m_receive_gift_btn.SetGray(!(FriendDataManager.Instance.Receive_gift_left_num > 0));
            m_receive_gift_btn.Visible  = true;
            m_received_gift_btn.Visible = false;
        }
Пример #3
0
        public static bool GetConfig(string fieldName, object fieldValue, out ConfTitle config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_Title", 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("Title 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
Пример #4
0
        public void SetData(AchievementMsg msg)
        {
            ConfAchievement confItem = ConfAchievement.Get(msg.Id);
            //m_Name_lab.Text = LocalizeModule.Instance.GetString(confItem.name);
            //m_Desc_lab.Text = LocalizeModule.Instance.GetString(confItem.info);
            long titleID = -1;

            long.TryParse(confItem.nobility, out titleID);

            if (titleID < 0)
            {
                m_Title_lab.Visible = false;
            }
            else
            {
                ConfTitle confTitle = ConfTitle.Get(titleID);
                if (confTitle != null)
                {
                    m_Title_lab.Visible         = true;
                    m_Title_lab.Text            = LocalizeModule.Instance.GetString("cheng_jiu_3", LocalizeModule.Instance.GetString(confTitle.name));
                    this.m_titleContentLab.Text = LocalizeModule.Instance.GetString(confTitle.info);
                }
                else
                {
                    m_Title_lab.Visible = false;
                }
            }
            m_PopItem01.SetData(msg, confItem.progress1, confItem.rewardicon1, confItem.reward1, confItem.cash1, 0);
            m_PopItem02.SetData(msg, confItem.progress2, confItem.rewardicon2, confItem.reward2, confItem.cash1, 1);
            m_PopItem03.SetData(msg, confItem.progress3, confItem.rewardicon3, confItem.reward3, confItem.cash1, 2);
        }
Пример #5
0
 private void ShowTaskTitle(long rewardTitleId)
 {
     if (rewardTitleId > 0)
     {
         m_title_txt.Visible = true;
         m_title_txt.Text    = ConfTitle.Get(rewardTitleId).name;
         m_reward_root.Widget.anchoredPosition = reward_up_pos;
     }
     else
     {
         m_title_txt.Visible = false;
         m_reward_root.Widget.anchoredPosition = reward_down_pos;
     }
 }
Пример #6
0
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_Title");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfTitle _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.id] = _conf;
             }
             resLoaded = true;
         }
     }
 }
Пример #7
0
        public static bool GetConfig(long id, out ConfTitle config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_Title", 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("Title 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }
Пример #8
0
        public void Refresh(PlayerFriendMsg info_)
        {
            m_player_id      = info_.PlayerId;
            m_name_text.Text = info_.Name;
            ConfTitle my_title = ConfTitle.Get(info_.TitleId);

            m_title_text.Text = null != my_title?LocalizeModule.Instance.GetString(my_title.name) : "";

            FriendDataManager.Instance.SetHeadIcon(m_head_tex, info_.Icon, info_.PlayerId);


            m_gender_icon.Sprite = CommonTools.GetGenderIcon(info_.Gender);
            m_lvl_text.Text      = string.Format("LV{0}", info_.Level);

            bool enable_gift = FriendDataManager.Instance.Send_gift_left_num <= 0 ? false : info_.Gift;

            m_send_gift_btn.Enable = enable_gift;
            m_send_gift_btn.SetGray(!enable_gift);
        }
Пример #9
0
        private static ConfTitle GetConfByDic(DataTable reader)
        {
            long   id      = reader.GetInt64(0);
            string benefit = reader.GetString(1);
            string source  = reader.GetString(2);
            int    expire  = reader.GetInt32(3);
            string icon    = reader.GetString(4);
            string desc    = reader.GetString(5);
            string info    = reader.GetString(6);
            string name    = reader.GetString(7);

            ConfTitle new_obj_ConfTitle = new ConfTitle(id,
                                                        benefit,
                                                        source,
                                                        expire,
                                                        icon,
                                                        desc,
                                                        info,
                                                        name
                                                        );

            return(new_obj_ConfTitle);
        }
Пример #10
0
        private List <ConfTitle> CompareTitle(SCTitleResponse res)
        {
            List <TitleMsg> titlemsgs = new List <TitleMsg>(res.Titles);

            titlemsgs.Sort(CompareTitle);
            List <ConfTitle> titles    = ConfTitle.array;
            List <ConfTitle> newTitles = new List <ConfTitle>();

            for (int i = 0; i < titlemsgs.Count; i++)
            {
                ConfTitle title = ConfTitle.Get(titlemsgs[i].TitleId);
                if (title == null)
                {
                    Debug.LogError("title id is none :" + titlemsgs[i].TitleId);
                    continue;
                }
                newTitles.Add(title);
            }
            for (int i = 0; i < titles.Count; i++)
            {
                bool hasTitle = false;
                for (int j = 0; j < titlemsgs.Count; j++)
                {
                    if (titlemsgs[j].TitleId == titles[i].id)
                    {
                        hasTitle = true;
                        break;
                    }
                }
                if (!hasTitle)
                {
                    newTitles.Add(titles[i]);
                }
            }
            return(newTitles);
        }
Пример #11
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();
 }
Пример #12
0
        public void Refresh(PlayerFriendMsg info_, IEnumerable <AchievementFriendMsg> achievements_)
        {
            ConfTitle my_title = ConfTitle.Get(info_.TitleId);
            string    temp_str = null != my_title?LocalizeModule.Instance.GetString(my_title.name) : "";

            m_rank_text.Text = $"{title_str}: {temp_str}";

            m_name_text.Text = info_.Name;
            m_lvl_text.Text  = LocalizeModule.Instance.GetString("UI_start_1.lvl", info_.Level);

            if (CommonTools.IsNeedDownloadIcon(info_.Icon))
            {
                if (FriendDataManager.Instance.Friend_icons_dict.ContainsKey(info_.PlayerId))
                {
                    FriendIcon f_icon = FriendDataManager.Instance.Friend_icons_dict[info_.PlayerId];
                    if (f_icon.Url != info_.Icon)
                    {
                        m_head_tex.OnLoadFinish = (tex_) => { f_icon.Url = info_.Icon; f_icon.m_tex = tex_; };
                        m_head_tex.TextureName  = info_.Icon;
                    }
                    else
                    {
                        m_head_tex.SetTexture(f_icon.m_tex);
                    }
                }
                else
                {
                    m_head_tex.OnLoadFinish = (tex_) =>
                    {
                        FriendIcon f_icon = new FriendIcon();
                        f_icon.Url   = info_.Icon;
                        f_icon.m_tex = tex_;
                        FriendDataManager.Instance.Friend_icons_dict.Add(info_.PlayerId, f_icon);
                    };
                    m_head_tex.TextureName = info_.Icon;
                }
            }
            else
            {
                m_head_tex.TextureName = CommonData.GetBigPortrait(info_.Icon);
            }

            m_player_id_text.Text = $"{id_str}: {info_.PlayerId.ToString()}";

            List <AchievementFriendMsg> msgs = new List <AchievementFriendMsg>(achievements_);

            m_achievement_grid.Clear();

            if (msgs.Count > 0)
            {
                List <AchievementFriendMsg> filtered_msgs = msgs.FindAll((item) =>
                {
                    return((item.SubmitStatus & (1 << 1)) > 0 || (item.SubmitStatus & (1 << 2)) > 0 || (item.SubmitStatus & (1 << 3)) > 0);
                });

                if (filtered_msgs.Count > 4)
                {
                    filtered_msgs = filtered_msgs.GetRange(0, 4);
                }

                if (filtered_msgs.Count > 0)
                {
                    m_achievement_grid.EnsureSize <PlayerAchievementComponent>(filtered_msgs.Count);

                    for (int i = 0; i < m_achievement_grid.ChildCount; ++i)
                    {
                        ConfAchievement            confAchieve = ConfAchievement.Get(filtered_msgs[i].Id);
                        PlayerAchievementComponent item        = m_achievement_grid.GetChild <PlayerAchievementComponent>(i);

                        if (confAchieve != null)
                        {
                            string reward_icon = string.Empty;
                            long   finish_time = 0L;
                            if ((filtered_msgs[i].SubmitStatus & (1 << 3)) > 0)
                            {
                                reward_icon = confAchieve.rewardicon3;
                                finish_time = filtered_msgs[i].FinishTime;
                            }
                            else if ((filtered_msgs[i].SubmitStatus & (1 << 2)) > 0)
                            {
                                reward_icon = confAchieve.rewardicon2;
                                finish_time = filtered_msgs[i].FinishTime2;
                            }
                            else if ((filtered_msgs[i].SubmitStatus & (1 << 1)) > 0)
                            {
                                reward_icon = confAchieve.rewardicon1;
                                finish_time = filtered_msgs[i].FinishTime1;
                            }

                            item.SetData(reward_icon, confAchieve.name, finish_time);
                        }

                        item.Visible = true;
                    }
                }
            }
        }
Пример #13
0
        public void SetData(ConfTitle confTitle, TitleMsg title, bool isChoose, bool isLock)
        {
            if (confTitle == null)
            {
                Visible = false;
                return;
            }
            this.m_detailLab.Text = LocalizeModule.Instance.GetString(confTitle.info);
            m_curTitle            = title;
            if (confTitle != null)
            {
                m_Name_lab.Text = LocalizeModule.Instance.GetString(confTitle.name);
                List <RankData> rankdatas = PlayerTitleHelper.GetRandData(confTitle.benefit);
                m_addition_lab[0].Visible = false;
                m_addition_lab[1].Visible = false;
                for (int i = 0; i < 2; i++)
                {
                    if (i < rankdatas.Count)
                    {
                        m_addition_lab[i].Text    = LocalizeModule.Instance.GetString(string.Format("RankType_{0}", rankdatas[i].type), rankdatas[i].value);
                        m_addition_lab[i].Visible = !isLock;
                    }
                }

                m_desc_lab.Text = LocalizeModule.Instance.GetString(confTitle.source);
            }
            m_icon_img.Sprite = confTitle.icon;
            bool active = !isLock;

            m_mask_img.Visible      = !active;
            m_lock_img.Visible      = !active;
            m_desc_lab.Visible      = !active;
            m_currentState          = isChoose;
            m_choose_btn.Enable     = active;
            m_Expired_lab.Visible   = false;
            m_Name_lab.color        = m_oriColor;
            m_addition_lab[0].color = m_oriColor;
            m_addition_lab[1].color = m_oriColor;
            m_TimeLab.Visible       = false;

            if (active)  //是否已拥有
            {
                long nowTicks = CommonTools.DateTimeToTimeStamp(System.DateTime.Now) / 10000;
                if (title.Deadline > 0)
                {
                    if (title.Deadline < nowTicks)
                    {
                        m_TimeLab.Visible = false;
                        //过期
                        m_Name_lab.color        = m_grayColor;
                        m_addition_lab[0].color = m_grayColor;
                        //m_additionNum01_lab.color = m_grayColor;
                        m_addition_lab[1].color = m_grayColor;
                        //m_additionNum02_lab.color = m_grayColor;
                        m_bg_img.SetGray(true);
                        m_icon_img.SetGray(true);
                        m_Expired_lab.Visible = true;
                        m_choose_btn.Enable   = false;
                    }
                    else
                    {
                        DateTime deadTime = CommonTools.TimeStampToDateTime(title.Deadline * 10000);
                        if (deadTime != null)
                        {
                            m_TimeLab.Text = CommonTools.SecondToTitleString((deadTime - DateTime.Now).TotalSeconds);
                        }
                        m_TimeLab.Visible = true;
                    }
                }
            }
            m_require_img.Visible = m_currentState;
        }