Exemplo n.º 1
0
 private List <AchievementMsg> OnFilter()
 {
     if (m_CurrntIndex == 0)
     {
         m_achieveMent_data.Sort(AchievementTools.s_Comparer);
         return(m_achieveMent_data);
     }
     else if (m_CurrntIndex == 1)
     {
         List <AchievementMsg> msgs = new List <AchievementMsg>();
         for (int i = 0; i < m_achieveMent_data.Count; i++)
         {
             AchievementMsg  msg         = m_achieveMent_data[i];
             ConfAchievement confAchieve = ConfAchievement.Get(msg.Id);
             if (confAchieve != null)
             {
                 if (msg.Progress < confAchieve.progress1)
                 {
                     msgs.Add(msg);
                 }
             }
         }
         return(msgs);
     }
     else
     {
         return(new List <AchievementMsg>());
     }
 }
Exemplo n.º 2
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);
        }
        private void AchievementStateChange(long id, bool state)
        {
            ConfAchievement achievement = ConfAchievement.Get(id);

            this.m_contentLab.Text = LocalizeModule.Instance.GetString("Achievement_progress", LocalizeModule.Instance.GetString(achievement.name));

            TimeModule.Instance.SetTimeout(() =>
            {
                this.m_component.Widget.sizeDelta = new Vector2(this.m_contentLab.Widget.sizeDelta.x + 10f, this.m_component.Widget.sizeDelta.y);
                m_component.Visible = state;
                //this.m_tweenPos.ResetAndPlay();
                TimeModule.Instance.SetTimeout(HideAchievement, 3f);
            }, 0.2f);
        }
Exemplo n.º 4
0
        private void OnInitUI(AchievementMsg msg)
        {
            ConfAchievement confItem = ConfAchievement.Get(msg.Id);

            m_Name_lab.Text   = LocalizeModule.Instance.GetString(confItem.name);
            m_Icon_img.Sprite = confItem.rewardicon1;
            if (msg.Progress < confItem.progress1)
            {
                m_Submit           = 0;
                m_Lock_img.Visible = true;
                m_Icon_img.Color   = new Color(1, 1, 1, 0.6f);
                m_Time_lab.Visible = false;
                m_Tips_img.Visible = false;
            }
            else
            {
                long finishTime = msg.FinishTime1;

                if (msg.Progress < confItem.progress2 && msg.Progress >= confItem.progress1)
                {
                    m_Icon_img.Sprite = confItem.rewardicon1;
                    m_Submit          = 2;
                    finishTime        = msg.FinishTime1;
                }
                else if (msg.Progress < confItem.progress3 && msg.Progress >= confItem.progress2)
                {
                    m_Icon_img.Sprite = confItem.rewardicon2;
                    m_Submit          = 6;
                    finishTime        = msg.FinishTime2;
                }
                else if (msg.Progress >= confItem.progress3)
                {
                    m_Icon_img.Sprite = confItem.rewardicon3;
                    m_Submit          = 14;
                    finishTime        = msg.FinishTime;
                }
                m_Tips_img.Visible = (msg.SubmitStatus < m_Submit);
                DateTime dt = CommonTools.TimeStampToDateTime(finishTime * 10000);
                if (dt != null)
                {
                    m_Time_lab.Text = string.Format("{0:D2}.{1:D2}.{2:D2}", dt.Year, dt.Month, dt.Day);
                }
                m_Lock_img.Visible = false;
                m_Icon_img.Color   = Color.white;
                LoadTipEffect();
            }
        }
Exemplo n.º 5
0
        public void SetData(AchievementMsg msg, int progress, string rewardicon, int reward, int cash, int index)
        {
            if (msg == null)
            {
                Visible = false;
                return;
            }
            this.m_needShowEffect = false;
            m_Id     = msg.Id;
            m_Stage  = index;
            m_Reward = reward;
            m_Cash   = cash;
            //m_submit = msg.SubmitStatus;
            ConfAchievement confItem = ConfAchievement.Get(msg.Id);

            if (confItem == null)
            {
                Visible = false;
                return;
            }
            long finishTime = msg.FinishTime1;

            if (index == 1)
            {
                finishTime = msg.FinishTime2;
            }
            else if (index == 2)
            {
                finishTime = msg.FinishTime;
            }
            DateTime dt = CommonTools.TimeStampToDateTime(finishTime * 10000);

            if (dt != null)
            {
                m_Time_lab.Text = string.Format("{0:D2}.{1:D2}.{2:D2}", dt.Year, dt.Month, dt.Day);
            }
            this.m_lockEffect.Visible = false;
            m_Icon_img.Sprite         = rewardicon;
            if (msg.Progress < progress)
            {
                //未解锁
                m_Icon_img.Color       = new Color(0.494f, 0.494f, 0.494f, 0.549f);
                m_BigLock_img.Visible  = true;
                m_SmallLock_img.Sprite = "icon_lock_2.png";
                m_SmallLock_img.Color  = m_SmallLockColor_color;
                m_RewardBG_img.Color   = m_GrayColor_color;

                m_Time_lab.Visible    = false;
                m_Term_lab.Text       = LocalizeModule.Instance.GetString("Achievement_" + confItem.type); //"Achievement_" + confItem.type
                m_Percent01_lab.Text  = msg.Progress.ToString();
                m_Percent01_lab.color = m_NumberRedColor;                                                  //m_PercentColor;
                m_Percent02_lab.Text  = string.Format("/{0}", progress);
                m_Percent02_lab.color = m_NumberGreenColor;
                m_Achieve_lab.Text    = reward.ToString();
                m_Cash_lab.Text       = cash.ToString();
                //m_Achieve_lab.color = m_CashGray_color;
                //m_Cash_lab.color = m_CashGray_color;
                m_Achieve_lab.color   = m_NormalReward01_color;
                m_Cash_lab.color      = m_NormalReward01_color;
                m_Receive_btn.Visible = false;
                m_Receive_img.Visible = false;
            }
            else
            {
                int submit = msg.SubmitStatus & m_ShiftFactor[index];
                //m_Percent02_lab.color = new Color(0.074f,0.258f,0.396f);
                if (0 == submit)
                {
                    this.m_needShowEffect = true;
                    this.m_lockEffect.EffectPrefabName = "UI_chengjiu0" + (index + 1) + ".prefab";
                    //TimeModule.Instance.SetTimeout(OnPlayEffect,1.8f);
                    //this.m_lockEffect.Visible = true;
                    //未领取
                    m_Icon_img.Color       = Color.white;
                    m_BigLock_img.Visible  = false;
                    m_SmallLock_img.Sprite = "icon_giftbox_1.png";
                    m_SmallLock_img.Color  = Color.white;
                    m_RewardBG_img.Color   = m_NormalRewardBG_color;

                    m_Time_lab.Visible    = true;
                    m_Term_lab.Text       = LocalizeModule.Instance.GetString("Achievement_" + confItem.type); //confItem.name
                    m_Percent01_lab.Text  = progress.ToString();
                    m_Percent01_lab.color = m_NumberGreenColor;                                                //m_NormalText_color;
                    m_Percent02_lab.Text  = string.Format("/{0}", progress);
                    m_Percent02_lab.color = m_NumberGreenColor;
                    m_Achieve_lab.Text    = reward.ToString();
                    m_Cash_lab.Text       = cash.ToString();
                    m_Achieve_lab.color   = m_NormalReward01_color;
                    m_Cash_lab.color      = m_NormalReward02_color;
                    //m_Receive_img.Sprite = "btn_common_3.png";
                    m_Receive_btn.Visible = true;
                    m_Receive_img.Visible = false;
                }
                else
                {
                    //已经领取
                    m_Icon_img.Color       = Color.white;
                    m_BigLock_img.Visible  = false;
                    m_SmallLock_img.Sprite = "icon_giftbox_1.png";
                    m_SmallLock_img.Color  = m_SmallLockColor_color;
                    m_RewardBG_img.Color   = m_GrayColor_color;

                    m_Time_lab.Visible    = true;
                    m_Term_lab.Text       = LocalizeModule.Instance.GetString("Achievement_" + confItem.type);
                    m_Percent01_lab.Text  = progress.ToString();
                    m_Percent01_lab.color = m_NormalText_color;
                    m_Percent02_lab.Text  = string.Format("/{0}", progress);
                    m_Percent02_lab.color = m_NormalText_color;
                    m_Achieve_lab.Text    = reward.ToString();
                    m_Cash_lab.Text       = cash.ToString();
                    m_Achieve_lab.color   = m_CashGray_color;
                    m_Cash_lab.color      = m_CashGray_color;
                    m_Receive_img.Visible = true;
                    m_Receive_btn.Visible = false;
                }
            }
        }
Exemplo n.º 6
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;
                    }
                }
            }
        }