Esempio n. 1
0
    public static void ReceiveHonorChosenRsp(CSPkg msg)
    {
        Singleton <CUIManager> .GetInstance().CloseSendMsgAlert();

        CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CPlayerInfoSystem.sPlayerInfoFormPath);

        SCPKG_USEHONOR_RSP stUseHonorRsp = msg.stPkgData.stUseHonorRsp;

        if (stUseHonorRsp.iErrorCode != 0)
        {
            Singleton <CUIManager> .GetInstance().OpenTips(Utility.ProtErrCodeToStr(1417, msg.stPkgData.stUseHonorRsp.iErrorCode), false, 1.5f, null, new object[0]);

            if (form != null)
            {
                COMDT_HONORINFO cOMDT_HONORINFO = new COMDT_HONORINFO();
                cOMDT_HONORINFO.iHonorID    = msg.stPkgData.stUseHonorRsp.iHonorID;
                cOMDT_HONORINFO.iHonorLevel = 0;
                Singleton <CPlayerHonorController> .GetInstance().UpdateSelectedHonor(form, cOMDT_HONORINFO);
            }
            return;
        }
        CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

        if (masterRoleInfo != null)
        {
            masterRoleInfo.selectedHonorID = msg.stPkgData.stUseHonorRsp.iHonorID;
            CPlayerProfile profile = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

            profile.ConvertRoleInfoData(masterRoleInfo);
            if (form != null)
            {
                Singleton <CPlayerHonorController> .GetInstance().Draw(form);
            }
        }
    }
    public void Draw(CUIFormScript form)
    {
        if (form != null)
        {
            GameObject widget = form.GetWidget(9);
            if (widget != null)
            {
                Utility.FindChild(widget, "pnlHonorInfo").CustomSetActive(true);
                GameObject obj3 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/HonorList");
                if (obj3 != null)
                {
                    CUIListScript component = obj3.GetComponent <CUIListScript>();
                    if (component != null)
                    {
                        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Item_Enable, new CUIEventManager.OnUIEventHandler(this.OnHonorItemEnable));

                        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Select_Change, new CUIEventManager.OnUIEventHandler(this.OnHonorSelectChange));

                        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Chosen, new CUIEventManager.OnUIEventHandler(this.OnHonorChosen));

                        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Item_Enable, new CUIEventManager.OnUIEventHandler(this.OnHonorItemEnable));

                        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Select_Change, new CUIEventManager.OnUIEventHandler(this.OnHonorSelectChange));

                        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Chosen, new CUIEventManager.OnUIEventHandler(this.OnHonorChosen));

                        this.m_honorInfoList.Clear();
                        CPlayerProfile profile = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

                        Dictionary <int, COMDT_HONORINFO> honorDic = profile.GetHonorDic();
                        int selectedHonorId = profile.GetSelectedHonorId();
                        Dictionary <int, COMDT_HONORINFO> .Enumerator enumerator = honorDic.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            KeyValuePair <int, COMDT_HONORINFO> current = enumerator.Current;
                            COMDT_HONORINFO item = current.Value;
                            if (item != null)
                            {
                                this.m_honorInfoList.Add(item);
                            }
                        }
                        if (this.m_honorInfoList != null)
                        {
                            if (< > f__am$cache1 == null)
                            {
Esempio n. 3
0
    private void SetHonorStatus(GameObject chosenGo, COMDT_HONORINFO honorInfo)
    {
        if (honorInfo == null)
        {
            chosenGo.CustomSetActive(false);
            return;
        }
        CPlayerProfile profile = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

        int selectedHonorId = profile.GetSelectedHonorId();

        if (honorInfo.iHonorID == selectedHonorId)
        {
            chosenGo.CustomSetActive(true);
        }
        else
        {
            chosenGo.CustomSetActive(false);
        }
    }
Esempio n. 4
0
    public void Draw(CUIFormScript form)
    {
        if (form == null)
        {
            return;
        }
        GameObject widget = form.GetWidget(9);

        if (widget == null)
        {
            return;
        }
        Utility.FindChild(widget, "pnlHonorInfo").CustomSetActive(true);
        GameObject gameObject = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/HonorList");

        if (gameObject == null)
        {
            return;
        }
        CUIListScript component = gameObject.GetComponent <CUIListScript>();

        if (component == null)
        {
            return;
        }
        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Item_Enable, new CUIEventManager.OnUIEventHandler(this.OnHonorItemEnable));

        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Select_Change, new CUIEventManager.OnUIEventHandler(this.OnHonorSelectChange));

        Singleton <CUIEventManager> .GetInstance().RemoveUIEventListener(enUIEventID.Player_Info_Honor_Chosen, new CUIEventManager.OnUIEventHandler(this.OnHonorChosen));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Item_Enable, new CUIEventManager.OnUIEventHandler(this.OnHonorItemEnable));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Select_Change, new CUIEventManager.OnUIEventHandler(this.OnHonorSelectChange));

        Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Player_Info_Honor_Chosen, new CUIEventManager.OnUIEventHandler(this.OnHonorChosen));

        this.m_honorInfoList.Clear();
        CPlayerProfile profile = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

        Dictionary <int, COMDT_HONORINFO> honorDic = profile.GetHonorDic();
        int selectedHonorId = profile.GetSelectedHonorId();

        Dictionary <int, COMDT_HONORINFO> .Enumerator enumerator = honorDic.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <int, COMDT_HONORINFO> current = enumerator.get_Current();
            COMDT_HONORINFO value = current.get_Value();
            if (value != null)
            {
                this.m_honorInfoList.Add(value);
            }
        }
        if (this.m_honorInfoList != null)
        {
            this.m_honorInfoList.Sort(delegate(COMDT_HONORINFO l, COMDT_HONORINFO r)
            {
                if (l == null)
                {
                    return(1);
                }
                if (r == null)
                {
                    return(-1);
                }
                return(l.iHonorID.CompareTo(r.iHonorID));
            });
        }
        component.SetElementAmount(this.m_honorInfoList.get_Count());
        component.SelectElement(-1, false);
        COMDT_HONORINFO honorInfo = null;

        honorDic.TryGetValue(selectedHonorId, ref honorInfo);
        this.UpdateSelectedHonor(form, honorInfo);
    }
Esempio n. 5
0
    public void UpdateSelectedHonor(CUIFormScript form, COMDT_HONORINFO honorInfo)
    {
        CTextManager instance = Singleton <CTextManager> .GetInstance();

        string     text   = instance.GetText("Player_Info_Honor_Btn_Using");
        string     text2  = instance.GetText("Player_Info_Honor_Btn_Use");
        string     text3  = instance.GetText("Player_Info_Honor_Btn_Browse");
        GameObject widget = form.GetWidget(9);

        if (widget == null)
        {
            return;
        }
        Transform      transform   = form.transform.Find("pnlBg/pnlBody/pnlHonorInfo/pnlContainer/SelectedHonor/Button");
        Button         button      = (transform == null) ? null : transform.GetComponent <Button>();
        GameObject     gameObject  = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/CurrentHonor/normal");
        GameObject     gameObject2 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/CurrentHonor/label");
        GameObject     gameObject3 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/CurrentHonor/cnt");
        GameObject     gameObject4 = Utility.FindChild(widget, "pnlHonorInfo/pnlContainer/SelectedHonor/Text");
        CPlayerProfile profile     = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

        int       selectedHonorId = profile.GetSelectedHonorId();
        CRoleInfo masterRoleInfo  = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

        bool flag = true;

        if (masterRoleInfo != null && masterRoleInfo.playerUllUID != profile.m_uuid)
        {
            flag = false;
        }
        if (honorInfo == null)
        {
            honorInfo = new COMDT_HONORINFO();
            if (button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text2);
            }
            if (gameObject != null)
            {
                this.SetHonorImage(gameObject.transform, honorInfo);
            }
            if (gameObject2 != null)
            {
                this.SetHonorName(gameObject2.transform, honorInfo);
            }
            if (gameObject3 != null)
            {
                this.SetHonorPoint(gameObject3.transform, honorInfo);
            }
            if (gameObject4 != null)
            {
                this.SetHonorDesc(gameObject4.transform, honorInfo);
            }
            if (!flag && button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text3);
                return;
            }
            return;
        }
        else
        {
            if (gameObject != null)
            {
                this.SetHonorImage(gameObject.transform, honorInfo);
            }
            if (gameObject2 != null)
            {
                this.SetHonorName(gameObject2.transform, honorInfo);
            }
            if (gameObject3 != null)
            {
                this.SetHonorPoint(gameObject3.transform, honorInfo);
            }
            if (gameObject4 != null)
            {
                this.SetHonorDesc(gameObject4.transform, honorInfo);
            }
            if (!flag && button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text3);
                return;
            }
            if (honorInfo.iHonorID == selectedHonorId && honorInfo.iHonorID != 0)
            {
                if (button != null)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                    CUICommonSystem.SetButtonName(transform.gameObject, text);
                }
            }
            else if (honorInfo.iHonorLevel <= 0)
            {
                if (button != null)
                {
                    CUICommonSystem.SetButtonEnableWithShader(button, false, true);
                    CUICommonSystem.SetButtonName(transform.gameObject, text2);
                }
            }
            else if (button != null)
            {
                CUICommonSystem.SetButtonEnableWithShader(button, true, true);
                CUICommonSystem.SetButtonName(transform.gameObject, text2);
            }
            return;
        }
    }
    private void UpdateCreditScore(CUIFormScript form)
    {
        if (form == null)
        {
            return;
        }
        GameObject widget = form.GetWidget(9);

        if (widget == null)
        {
            return;
        }
        GameObject gameObject = Utility.FindChild(widget, "pnlCreditScoreInfo");

        if (gameObject == null)
        {
            return;
        }
        gameObject.CustomSetActive(true);
        CPlayerProfile profile = Singleton <CPlayerInfoSystem> .GetInstance().GetProfile();

        uint creditScore = profile.creditScore;

        this.m_CreditLevelInfo = this.GetCreditLevelInfoByScore((int)creditScore);
        if (this.m_CreditLevelInfo == null)
        {
            return;
        }
        Text       componetInChild = Utility.GetComponetInChild <Text>(gameObject, "pnlContainer/pnlCreditScore/CreditValue/ScoreValue");
        GameObject gameObject2     = Utility.FindChild(gameObject, "pnlContainer/pnlCreditScore/CreditValue/CreditLevel/LevelValue");
        GameObject gameObject3     = Utility.FindChild(gameObject, "pnlContainer/pnlCreditAward/SelfAward");
        GameObject gameObject4     = Utility.FindChild(gameObject, "pnlContainer/pnlCreditAward/ComplaintInfo");

        if (componetInChild != null)
        {
            componetInChild.text = creditScore.ToString();
        }
        Image componetInChild2 = Utility.GetComponetInChild <Image>(gameObject, "pnlContainer/pnlCreditScore/IconBg");

        if (componetInChild2 != null)
        {
            componetInChild2.SetSprite(this.GetBgByCreditLevel(this.m_CreditLevelInfo.bCreditLevel), form, true, false, false, false);
        }
        if (gameObject2 != null)
        {
            for (int i = 0; i < 3; i++)
            {
                gameObject2.transform.GetChild(i).gameObject.CustomSetActive((int)this.m_CreditLevelInfo.bCreditLevel > i);
            }
        }
        if (gameObject3 != null)
        {
            GameObject obj         = Utility.FindChild(gameObject3, "Title-Red");
            GameObject gameObject5 = Utility.FindChild(gameObject3, "TitleTxt_Red");
            GameObject obj2        = Utility.FindChild(gameObject3, "Title-Blue");
            GameObject gameObject6 = Utility.FindChild(gameObject3, "TitleTxt_Blue");
            if (this.m_CreditLevelInfo.bCreditLevelResult == 0)
            {
                obj.CustomSetActive(true);
                gameObject5.CustomSetActive(true);
                obj2.CustomSetActive(false);
                gameObject6.CustomSetActive(false);
                if (gameObject5 != null)
                {
                    Text component = gameObject5.GetComponent <Text>();
                    component.text = Singleton <CTextManager> .get_instance().GetText("Credit_Punish_Title");
                }
            }
            else
            {
                obj.CustomSetActive(false);
                gameObject5.CustomSetActive(false);
                obj2.CustomSetActive(true);
                gameObject6.CustomSetActive(true);
                if (gameObject6 != null)
                {
                    Text component2 = gameObject6.GetComponent <Text>();
                    component2.text = Singleton <CTextManager> .get_instance().GetText("Credit_Reward_Title");
                }
            }
            int num = 0;
            for (int j = 0; j < this.m_CreditLevelInfo.astCreditRewardDetail.Length; j++)
            {
                if (!string.IsNullOrEmpty(this.m_CreditLevelInfo.astCreditRewardDetail[j].szCreditRewardItemIcon))
                {
                    num++;
                }
            }
            CUIListScript componetInChild3 = Utility.GetComponetInChild <CUIListScript>(gameObject3, "pnlAward");
            if (componetInChild3 != null)
            {
                componetInChild3.SetElementAmount(num);
            }
            if (num > 0)
            {
                gameObject3.CustomSetActive(true);
            }
            else
            {
                gameObject3.CustomSetActive(false);
            }
        }
        if (gameObject4 != null)
        {
            uint       dwConfValue      = GameDataMgr.globalInfoDatabin.GetDataByKey(302u).dwConfValue;
            Text       componetInChild4 = Utility.GetComponetInChild <Text>(gameObject4, "Progress/progressBg/txtProgress");
            Image      componetInChild5 = Utility.GetComponetInChild <Image>(gameObject4, "Tips/Image");
            Text       componetInChild6 = Utility.GetComponetInChild <Text>(gameObject4, "Tips/Text");
            float      num2             = Utility.Divide((uint)profile.sumDelCreditValue, dwConfValue);
            GameObject gameObject7;
            if (num2 * 100f > 66f)
            {
                gameObject7 = Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Red");
                Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Yellow").CustomSetActive(false);
                Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Green").CustomSetActive(false);
            }
            else if (num2 * 100f > 33f)
            {
                Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Red").CustomSetActive(false);
                gameObject7 = Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Yellow");
                Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Green").CustomSetActive(false);
            }
            else
            {
                Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Red").CustomSetActive(false);
                Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Yellow").CustomSetActive(false);
                gameObject7 = Utility.FindChild(gameObject4, "Progress/progressBg/imgProgress_Green");
            }
            gameObject7.CustomSetActive(true);
            gameObject7.GetComponent <Image>().fillAmount = num2;
            componetInChild4.text = string.Format("{0}/{1}", profile.sumDelCreditValue, dwConfValue);
            componetInChild5.SetSprite(this.GetTipsIconByProportion(num2), form, true, false, false, false);
            componetInChild6.text = this.GetTipsByComplaintTypeAndProportion(profile.mostDelCreditType, num2);
        }
    }