Exemple #1
0
        public static ListView <UrlAction> ParseFromText(string text, char[] spliter = null)
        {
            ListView <UrlAction> listView = new ListView <UrlAction>();

            if (spliter == null)
            {
                spliter = UrlAction.MultiSpliter;
            }
            try
            {
                string[] array = text.Split(spliter, 1);
                for (int i = 0; i < array.Length; i++)
                {
                    string[] array2 = array[i].Split(UrlAction.InnerSpliter, 1);
                    if (array2.Length > 0)
                    {
                        DictionaryView <string, string> dictionaryView = new DictionaryView <string, string>();
                        for (int j = 1; j < array2.Length; j++)
                        {
                            string[] array3 = array2[j].Split(UrlAction.ParamSpliter);
                            if (array3 != null && array3.Length == 2)
                            {
                                dictionaryView.Add(array3[0], array3[1]);
                            }
                        }
                        UrlAction urlAction = new UrlAction();
                        urlAction.target = array2[0];
                        urlAction.action = UrlAction.Action.none;
                        if (dictionaryView.ContainsKey("action"))
                        {
                            string text2 = dictionaryView["action"];
                            string text3 = text2;
                            string text4 = text3;
                            if (text4 != null)
                            {
                                if (UrlAction.< > f__switch$map2 == null)
                                {
                                    Dictionary <string, int> dictionary = new Dictionary <string, int>(4);
                                    dictionary.Add("openUrl", 0);
                                    dictionary.Add("openForm", 1);
                                    dictionary.Add("buy", 2);
                                    dictionary.Add("openMatchUrl", 3);
                                    UrlAction.< > f__switch$map2 = dictionary;
                                }
                                int num;
                                if (UrlAction.< > f__switch$map2.TryGetValue(text4, ref num))
                                {
                                    switch (num)
                                    {
                                    case 0:
                                        urlAction.action = UrlAction.Action.openUrl;
                                        urlAction.url    = dictionaryView["url"];
                                        break;

                                    case 1:
                                        urlAction.action = UrlAction.Action.openForm;
                                        urlAction.form   = (RES_GAME_ENTRANCE_TYPE)int.Parse(dictionaryView["form"]);
                                        break;

                                    case 2:
                                        urlAction.action   = UrlAction.Action.buy;
                                        urlAction.prodType = (COM_ITEM_TYPE)int.Parse(dictionaryView["prodType"]);
                                        urlAction.prodID   = uint.Parse(dictionaryView["prodID"]);
                                        if (dictionaryView.ContainsKey("prodSpec"))
                                        {
                                            int.TryParse(dictionaryView["prodSpec"], ref urlAction.prodSpec);
                                        }
                                        break;

                                    case 3:
                                    {
                                        int num2 = text.IndexOf("#action=openMatchUrl");
                                        if (num2 > 0)
                                        {
                                            urlAction.target = text.Substring(0, num2);
                                        }
                                        urlAction.action = UrlAction.Action.openMatchUrl;
                                        break;
                                    }
                                    }
                                }
                            }
                        }
                        if (dictionaryView.ContainsKey("overTime"))
                        {
                            ulong.TryParse(dictionaryView["overTime"], ref urlAction.overTime);
                        }
                        if (dictionaryView.ContainsKey("showTime"))
                        {
                            int.TryParse(dictionaryView["showTime"], ref urlAction.showTime);
                        }
                        listView.Add(urlAction);
                    }
                }
            }
            catch (Exception var_11_299)
            {
            }
            return(listView);
        }
        private static void ShowReward(CUIFormScript belongForm, COMDT_SETTLE_RESULT_DETAIL settleData)
        {
            if (Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo() == null)
            {
                return;
            }
            GameObject gameObject  = belongForm.transform.Find("Root/Panel_Award/Award/ItemAndCoin/Panel_Gold").gameObject;
            Text       component   = gameObject.transform.Find("GoldNum").gameObject.GetComponent <Text>();
            GameObject gameObject2 = gameObject.transform.Find("GoldMax").gameObject;

            if (settleData.stAcntInfo.bReachDailyLimit > 0)
            {
                gameObject2.CustomSetActive(true);
            }
            else
            {
                gameObject2.CustomSetActive(false);
            }
            component.text = "0";
            COMDT_REWARD_DETAIL stReward   = settleData.stReward;
            COMDT_ACNT_INFO     stAcntInfo = settleData.stAcntInfo;

            if (stAcntInfo != null)
            {
                GameObject         gameObject3 = belongForm.transform.FindChild("Root/Panel_Award/Award/Panel_PlayerExp/PvpExpNode").gameObject;
                Text               component2  = gameObject3.transform.FindChild("PvpExpTxt").gameObject.GetComponent <Text>();
                Text               component3  = gameObject3.transform.FindChild("AddPvpExpTxt").gameObject.GetComponent <Text>();
                RectTransform      component4  = gameObject3.transform.FindChild("PvpExpSliderBg/BasePvpExpSlider").gameObject.GetComponent <RectTransform>();
                RectTransform      component5  = gameObject3.transform.FindChild("PvpExpSliderBg/AddPvpExpSlider").gameObject.GetComponent <RectTransform>();
                Text               component6  = gameObject3.transform.FindChild("PlayerName").gameObject.GetComponent <Text>();
                CUIHttpImageScript component7  = gameObject3.transform.FindChild("HeadImage").gameObject.GetComponent <CUIHttpImageScript>();
                Text               component8  = gameObject3.transform.FindChild("PvpLevelTxt").gameObject.GetComponent <Text>();
                Image              component9  = gameObject3.transform.FindChild("NobeIcon").gameObject.GetComponent <Image>();
                MonoSingleton <NobeSys> .GetInstance().SetNobeIcon(component9, (int)Singleton <CRoleInfoManager> .get_instance().GetMasterRoleInfo().GetNobeInfo().stGameVipClient.dwCurLevel, false);

                Image component10 = gameObject3.transform.FindChild("HeadFrame").gameObject.GetComponent <Image>();
                MonoSingleton <NobeSys> .GetInstance().SetHeadIconBk(component10, (int)Singleton <CRoleInfoManager> .get_instance().GetMasterRoleInfo().GetNobeInfo().stGameVipClient.dwHeadIconId);

                component8.text = string.Format("Lv.{0}", stAcntInfo.dwPvpLv.ToString());
                ResAcntPvpExpInfo dataByKey   = GameDataMgr.acntPvpExpDatabin.GetDataByKey((uint)((byte)stAcntInfo.dwPvpLv));
                GameObject        gameObject4 = gameObject3.transform.FindChild("ExpMax").gameObject;
                if (stAcntInfo.bExpDailyLimit == 0)
                {
                    gameObject4.CustomSetActive(false);
                }
                component2.text = string.Format("{0}/{1}", stAcntInfo.dwPvpExp, dataByKey.dwNeedExp);
                component3.text = string.Format("+{0}", stAcntInfo.dwPvpSettleExp);
                CUICommonSystem.AppendMultipleText(component3, CUseable.GetMultiple(stAcntInfo.dwPvpSettleBaseExp, ref settleData.stMultipleDetail, 15, -1));
                component6.text = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().Name;

                string headUrl = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo().HeadUrl;

                if (!CSysDynamicBlock.bLobbyEntryBlocked)
                {
                    component7.SetImageUrl(headUrl);
                }
                if (stAcntInfo.dwPvpSettleExp > 0u)
                {
                    Singleton <CSoundManager> .GetInstance().PostEvent("UI_count_jingyan", null);
                }
                float num = 0f;
                if (stAcntInfo.dwPvpExp < stAcntInfo.dwPvpSettleExp)
                {
                    component4.sizeDelta     = new Vector2(num * 260f, component4.sizeDelta.y);
                    PVESettleView._lvUpGrade = stAcntInfo.dwPvpLv;
                }
                else
                {
                    num = (stAcntInfo.dwPvpExp - stAcntInfo.dwPvpSettleExp) / dataByKey.dwNeedExp;
                    component4.sizeDelta     = new Vector2(num * 260f, component4.sizeDelta.y);
                    PVESettleView._lvUpGrade = 0u;
                }
                float expTo = stAcntInfo.dwPvpExp / dataByKey.dwNeedExp;
                PVESettleView._expFrom      = num;
                PVESettleView._expTo        = expTo;
                component5.sizeDelta        = new Vector2(num * 260f, component5.sizeDelta.y);
                PVESettleView._expTweenRect = component5;
                PVESettleView._coinFrom     = 0f;
                PVESettleView._coinTo       = 0f;
                for (int i = 0; i < (int)stReward.bNum; i++)
                {
                    COMDT_REWARD_INFO cOMDT_REWARD_INFO = stReward.astRewardDetail[i];
                    byte bType = cOMDT_REWARD_INFO.bType;
                    if (bType == 11)
                    {
                        PVESettleView._coinTo    = cOMDT_REWARD_INFO.stRewardInfo.dwPvpCoin;
                        PVESettleView._coinMulti = settleData.stMultipleDetail;
                    }
                }
                PVESettleView._coinTweenText = component;
                PVESettleView.DoCoinAndExpTween();
            }
            ListView <COMDT_REWARD_INFO> listView = new ListView <COMDT_REWARD_INFO>();
            GameObject gameObject5 = belongForm.transform.Find("Root/Panel_Award/Award/Panel_QQVIPGold").gameObject;

            if (gameObject5 != null)
            {
                gameObject5.CustomSetActive(false);
            }
            GameObject gameObject6 = belongForm.transform.Find("Root/Panel_Award/Award/ItemAndCoin/FirstGain").gameObject;

            if (gameObject6 != null)
            {
                gameObject6.CustomSetActive(false);
            }
            for (int j = 0; j < (int)stReward.bNum; j++)
            {
                COMDT_REWARD_INFO cOMDT_REWARD_INFO = stReward.astRewardDetail[j];
                byte bType = cOMDT_REWARD_INFO.bType;
                if (bType != 6)
                {
                    if (bType == 11)
                    {
                        CUICommonSystem.AppendMultipleText(component, CUseable.GetMultiple(stAcntInfo.dwPvpSettleBaseCoin, ref settleData.stMultipleDetail, 0, -1));
                        if (gameObject5 != null)
                        {
                            gameObject5.CustomSetActive(false);
                            Text       component11 = gameObject5.transform.FindChild("Text_Value").gameObject.GetComponent <Text>();
                            GameObject gameObject7 = gameObject5.transform.FindChild("Icon_QQVIP").gameObject;
                            GameObject gameObject8 = gameObject5.transform.FindChild("Icon_QQSVIP").gameObject;
                            gameObject7.CustomSetActive(false);
                            gameObject8.CustomSetActive(false);
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            uint qqVipExtraCoin = CUseable.GetQqVipExtraCoin(cOMDT_REWARD_INFO.stRewardInfo.dwPvpCoin, ref settleData.stMultipleDetail, 0);
                            if (masterRoleInfo != null && qqVipExtraCoin > 0u)
                            {
                                component11.text = string.Format("+{0}", qqVipExtraCoin);
                                if (masterRoleInfo.HasVip(16))
                                {
                                    gameObject5.CustomSetActive(true);
                                    gameObject8.CustomSetActive(true);
                                }
                                else if (masterRoleInfo.HasVip(1))
                                {
                                    gameObject5.CustomSetActive(true);
                                    gameObject7.CustomSetActive(true);
                                }
                            }
                            gameObject5.CustomSetActive(false);
                        }
                    }
                }
                else
                {
                    listView.Add(stReward.astRewardDetail[j]);
                    if (gameObject6 != null)
                    {
                        gameObject6.CustomSetActive(false);
                    }
                }
            }
            GameObject gameObject9 = belongForm.transform.Find("Root/Panel_Award/Award/ItemAndCoin/itemCell").gameObject;

            gameObject9.CustomSetActive(false);
            if (listView.get_Count() > 0)
            {
                Text component12 = gameObject9.transform.FindChild("ItemName").gameObject.GetComponent <Text>();
                gameObject9.CustomSetActive(true);
                COMDT_REWARD_INFO cOMDT_REWARD_INFO = listView.get_Item(0);
                PVESettleView.SetItemEtcCell(belongForm, gameObject9, component12, cOMDT_REWARD_INFO, settleData);
            }
        }
        public Action LoadActionResource(string _actionName)
        {
            Action action = null;

            if (_actionName == null)
            {
                DebugHelper.Assert(_actionName != null, "can't load action with name = null");
                return(null);
            }
            if (this.actionResourceSet.TryGetValue(_actionName, out action))
            {
                if (action != null)
                {
                    return(action);
                }
                this.actionResourceSet.Remove(_actionName);
            }
            CBinaryObject cBinaryObject = ActionManager.Instance.resLoader.LoadAge(_actionName) as CBinaryObject;

            if (cBinaryObject == null)
            {
                return(null);
            }
            SecurityParser securityParser = new SecurityParser();

            try
            {
                securityParser.LoadXml(Encoding.get_UTF8().GetString(cBinaryObject.m_data));
            }
            catch (Exception ex)
            {
                DebugHelper.Assert(false, "Load xml Exception for action name = {0}, exception = {1}", new object[]
                {
                    _actionName,
                    ex.get_Message()
                });
                return(null);
            }
            action            = new Action();
            action.name       = _actionName;
            action.enabled    = false;
            action.actionName = _actionName;
            this.actionResourceSet.Add(_actionName, action);
            Singleton <CResourceManager> .GetInstance().RemoveCachedResource(_actionName);

            SecurityElement securityElement  = securityParser.SelectSingleNode("Project");
            SecurityElement securityElement2 = (securityElement != null) ? securityElement.SearchForChildByTag("TemplateObjectList") : null;
            SecurityElement securityElement3 = (securityElement != null) ? securityElement.SearchForChildByTag("Action") : null;
            SecurityElement securityElement4 = (securityElement != null) ? securityElement.SearchForChildByTag("RefParamList") : null;

            DebugHelper.Assert(securityElement3 != null, "actionNode!=null");
            if (securityElement3 != null)
            {
                action.length = ActionUtility.SecToMs(float.Parse(securityElement3.Attribute("length")));
                action.loop   = bool.Parse(securityElement3.Attribute("loop"));
            }
            if (securityElement2 != null && securityElement2.get_Children() != null)
            {
                for (int i = 0; i < securityElement2.get_Children().get_Count(); i++)
                {
                    SecurityElement securityElement5 = securityElement2.get_Children().get_Item(i) as SecurityElement;
                    string          str  = securityElement5.Attribute("objectName");
                    string          text = securityElement5.Attribute("id");
                    int             id   = int.Parse(text);
                    action.AddTemplateObject(str, id);
                }
            }
            if (securityElement4 != null && securityElement4.get_Children() != null)
            {
                for (int j = 0; j < securityElement4.get_Children().get_Count(); j++)
                {
                    this.LoadRefParamNode(action, securityElement4.get_Children().get_Item(j) as SecurityElement);
                }
            }
            if (securityElement3 != null && securityElement3.get_Children() != null)
            {
                for (int k = 0; k < securityElement3.get_Children().get_Count(); k++)
                {
                    SecurityElement securityElement6 = securityElement3.get_Children().get_Item(k) as SecurityElement;
                    string          text2            = securityElement6.Attribute("eventType");
                    if (!text2.Contains(".") && text2.get_Length() > 0)
                    {
                        text2 = "AGE." + text2;
                    }
                    Type type = Utility.GetType(text2);
                    if (type != null)
                    {
                        string name = string.Empty;
                        bool   flag = false;
                        if (securityElement6.Attribute("refParamName") != null)
                        {
                            name = securityElement6.Attribute("refParamName");
                        }
                        if (securityElement6.Attribute("useRefParam") != null)
                        {
                            flag = bool.Parse(securityElement6.Attribute("useRefParam"));
                        }
                        bool enabled = bool.Parse(securityElement6.Attribute("enabled"));
                        if (flag)
                        {
                            action.refParams.GetRefParam(name, ref enabled);
                        }
                        Track track = action.AddTrack(type);
                        track.enabled   = enabled;
                        track.trackName = securityElement6.Attribute("trackName");
                        if (securityElement6.Attribute("execOnActionCompleted") != null)
                        {
                            track.execOnActionCompleted = bool.Parse(securityElement6.Attribute("execOnActionCompleted"));
                        }
                        if (securityElement6.Attribute("execOnForceStopped") != null)
                        {
                            track.execOnForceStopped = bool.Parse(securityElement6.Attribute("execOnForceStopped"));
                        }
                        if (flag)
                        {
                            FieldInfo field = type.GetField(securityElement6.Attribute("enabled"));
                            action.refParams.AddRefData(name, field, track);
                        }
                        if (securityElement6.Attribute("r") != null)
                        {
                            track.color.r = float.Parse(securityElement6.Attribute("r"));
                        }
                        if (securityElement6.Attribute("g") != null)
                        {
                            track.color.g = float.Parse(securityElement6.Attribute("g"));
                        }
                        if (securityElement6.Attribute("b") != null)
                        {
                            track.color.b = float.Parse(securityElement6.Attribute("b"));
                        }
                        ListView <SecurityElement> listView = new ListView <SecurityElement>();
                        if (securityElement6.get_Children() != null)
                        {
                            for (int l = 0; l < securityElement6.get_Children().get_Count(); l++)
                            {
                                SecurityElement securityElement7 = securityElement6.get_Children().get_Item(l) as SecurityElement;
                                if (securityElement7.get_Tag() != "Event" && securityElement7.get_Tag() != "Condition")
                                {
                                    listView.Add(securityElement7);
                                }
                            }
                            for (int m = 0; m < securityElement6.get_Children().get_Count(); m++)
                            {
                                SecurityElement securityElement8 = securityElement6.get_Children().get_Item(m) as SecurityElement;
                                if (securityElement8.get_Tag() == "Condition")
                                {
                                    SecurityElement securityElement9 = securityElement8;
                                    int             num   = int.Parse(securityElement9.Attribute("id"));
                                    bool            flag2 = bool.Parse(securityElement9.Attribute("status"));
                                    if (track.waitForConditions == null)
                                    {
                                        track.waitForConditions = new Dictionary <int, bool>();
                                    }
                                    track.waitForConditions.Add(num, flag2);
                                }
                                else if (!(securityElement8.get_Tag() != "Event"))
                                {
                                    int time   = ActionUtility.SecToMs(float.Parse(securityElement8.Attribute("time")));
                                    int length = 0;
                                    if (track.IsDurationEvent)
                                    {
                                        length = ActionUtility.SecToMs(float.Parse(securityElement8.Attribute("length")));
                                    }
                                    BaseEvent baseEvent = track.AddEvent(time, length);
                                    for (int n = 0; n < listView.Count; n++)
                                    {
                                        this.SetEventField(action, baseEvent, listView[n]);
                                    }
                                    if (securityElement8.get_Children() != null)
                                    {
                                        for (int num2 = 0; num2 < securityElement8.get_Children().get_Count(); num2++)
                                        {
                                            this.SetEventField(action, baseEvent, securityElement8.get_Children().get_Item(num2) as SecurityElement);
                                        }
                                    }
                                    baseEvent.OnLoaded();
                                }
                            }
                        }
                    }
                    else
                    {
                        Debug.LogError("Invalid event type \"" + securityElement6.Attribute("eventType") + "\"!");
                    }
                }
            }
            return(action);
        }
        public void CalculateKDA(COMDT_GAME_INFO gameInfo)
        {
            CRoleInfo masterRoleInfo = this.GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "masterRoleInfo is null");
            if (masterRoleInfo != null)
            {
                PlayerKDA hostKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetHostKDA();

                if (hostKDA != null)
                {
                    int num   = 0;
                    int num2  = 0;
                    int num3  = 0;
                    int num4  = 0;
                    int num5  = 0;
                    int num6  = 0;
                    int num7  = 0;
                    int num8  = 0;
                    int num9  = 0;
                    int num10 = 0;
                    int num11 = 0;
                    int num12 = 0;
                    ListView <HeroKDA> .Enumerator enumerator = hostKDA.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        if (enumerator.Current != null)
                        {
                            num   += enumerator.Current.LegendaryNum;
                            num2  += enumerator.Current.PentaKillNum;
                            num3  += enumerator.Current.QuataryKillNum;
                            num4  += enumerator.Current.TripleKillNum;
                            num5  += enumerator.Current.DoubleKillNum;
                            num8  += !enumerator.Current.bHurtMost ? 0 : 1;
                            num9  += !enumerator.Current.bHurtTakenMost ? 0 : 1;
                            num10 += !enumerator.Current.bGetCoinMost ? 0 : 1;
                            num11 += !enumerator.Current.bAsssistMost ? 0 : 1;
                            num12 += !enumerator.Current.bKillMost ? 0 : 1;
                        }
                    }
                    if (gameInfo.bGameResult == 1)
                    {
                        uint mvpPlayer = Singleton <BattleStatistic> .instance.GetMvpPlayer(hostKDA.PlayerCamp, true);

                        if (mvpPlayer != 0)
                        {
                            num6 = (mvpPlayer != hostKDA.PlayerId) ? 0 : 1;
                        }
                    }
                    else if (gameInfo.bGameResult == 2)
                    {
                        uint num14 = Singleton <BattleStatistic> .instance.GetMvpPlayer(hostKDA.PlayerCamp, false);

                        if (num14 != 0)
                        {
                            num7 = (num14 != hostKDA.PlayerId) ? 0 : 1;
                        }
                    }
                    bool flag   = false;
                    bool flag2  = false;
                    bool flag3  = false;
                    bool flag4  = false;
                    bool flag5  = false;
                    bool flag6  = false;
                    bool flag7  = false;
                    bool flag8  = false;
                    bool flag9  = false;
                    bool flag10 = false;
                    bool flag11 = false;
                    bool flag12 = false;
                    int  index  = 0;
                    ListView <COMDT_STATISTIC_KEY_VALUE_INFO> inList = new ListView <COMDT_STATISTIC_KEY_VALUE_INFO>();
                    while (index < masterRoleInfo.pvpDetail.stKVDetail.dwNum)
                    {
                        COMDT_STATISTIC_KEY_VALUE_INFO comdt_statistic_key_value_info = masterRoleInfo.pvpDetail.stKVDetail.astKVDetail[index];
                        switch (comdt_statistic_key_value_info.dwKey)
                        {
                        case 13:
                            comdt_statistic_key_value_info.dwValue += (uint)num6;
                            flag6 = true;
                            break;

                        case 14:
                            comdt_statistic_key_value_info.dwValue += (uint)num7;
                            flag7 = true;
                            break;

                        case 15:
                            comdt_statistic_key_value_info.dwValue += (uint)num;
                            flag5 = true;
                            break;

                        case 0x10:
                            comdt_statistic_key_value_info.dwValue += (uint)num5;
                            flag = true;
                            break;

                        case 0x11:
                            comdt_statistic_key_value_info.dwValue += (uint)num4;
                            flag2 = true;
                            break;

                        case 0x1b:
                            comdt_statistic_key_value_info.dwValue += (uint)num3;
                            flag3 = true;
                            break;

                        case 0x1c:
                            comdt_statistic_key_value_info.dwValue += (uint)num2;
                            flag4 = true;
                            break;

                        case 0x1d:
                            comdt_statistic_key_value_info.dwValue += (uint)num8;
                            flag8 = true;
                            break;

                        case 30:
                            comdt_statistic_key_value_info.dwValue += (uint)num10;
                            flag10 = true;
                            break;

                        case 0x1f:
                            comdt_statistic_key_value_info.dwValue += (uint)num9;
                            flag9 = true;
                            break;

                        case 0x20:
                            comdt_statistic_key_value_info.dwValue += (uint)num11;
                            flag11 = true;
                            break;

                        case 0x21:
                            comdt_statistic_key_value_info.dwValue += (uint)num12;
                            flag12 = true;
                            break;
                        }
                        index++;
                    }
                    COMDT_STATISTIC_KEY_VALUE_INFO item = null;
                    if (!flag)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x10,
                            dwValue = (uint)num5
                        };
                        inList.Add(item);
                    }
                    if (!flag2)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x11,
                            dwValue = (uint)num4
                        };
                        inList.Add(item);
                    }
                    if (!flag3)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x1b,
                            dwValue = (uint)num3
                        };
                        inList.Add(item);
                    }
                    if (!flag4)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x1c,
                            dwValue = (uint)num2
                        };
                        inList.Add(item);
                    }
                    if (!flag5)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 15,
                            dwValue = (uint)num
                        };
                        inList.Add(item);
                    }
                    if (!flag6)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 13,
                            dwValue = (uint)num6
                        };
                        inList.Add(item);
                    }
                    if (!flag7)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 14,
                            dwValue = (uint)num7
                        };
                        inList.Add(item);
                    }
                    if (!flag8)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x1d,
                            dwValue = (uint)num8
                        };
                        inList.Add(item);
                    }
                    if (!flag9)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x1f,
                            dwValue = (uint)num9
                        };
                        inList.Add(item);
                    }
                    if (!flag10)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 30,
                            dwValue = (uint)num10
                        };
                        inList.Add(item);
                    }
                    if (!flag11)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x20,
                            dwValue = (uint)num11
                        };
                        inList.Add(item);
                    }
                    if (!flag12)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x21,
                            dwValue = (uint)num12
                        };
                        inList.Add(item);
                    }
                    if (inList.Count > 0)
                    {
                        masterRoleInfo.pvpDetail.stKVDetail.dwNum += (uint)inList.Count;
                        inList.AddRange(masterRoleInfo.pvpDetail.stKVDetail.astKVDetail);
                        masterRoleInfo.pvpDetail.stKVDetail.astKVDetail = LinqS.ToArray <COMDT_STATISTIC_KEY_VALUE_INFO>(inList);
                    }
                }
            }
        }
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors;
                int count = heroActors.get_Count();
                for (int i = 0; i < count; i++)
                {
                    if (heroActors.get_Item(i).handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp && heroActors.get_Item(i).handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!heroActors.get_Item(i).handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(heroActors.get_Item(i).handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE:
            {
                if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.handle);
                }
                List <Player> allPlayers = Singleton <GamePlayerCenter> .instance.GetAllPlayers();

                if (allPlayers != null)
                {
                    int count2 = allPlayers.get_Count();
                    for (int j = 0; j < count2; j++)
                    {
                        if (!(allPlayers.get_Item(j).Captain == attacker) && allPlayers.get_Item(j).Captain.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp && this.IsActorInRange(allPlayers.get_Item(j).Captain, target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius) && (!allPlayers.get_Item(j).Captain.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                        {
                            if (allPlayers.get_Item(j).Captain.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
                            {
                                CallActorWrapper callActorWrapper = allPlayers.get_Item(j).Captain.handle.ActorControl as CallActorWrapper;
                                if (callActorWrapper != null)
                                {
                                    relatedHeros.Add(callActorWrapper.GetHostActor());
                                }
                            }
                            else
                            {
                                relatedHeros.Add(allPlayers.get_Item(j).Captain.handle);
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL:
                if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.handle);
                }
                break;

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST:
            {
                HashSet <uint>             assistSet  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator = assistSet.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.get_Current());

                    if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!actor.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor.handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL:
            {
                if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.handle);
                }
                HashSet <uint>             assistSet2  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator2 = assistSet2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.get_Current());

                    if (actor2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !relatedHeros.Contains(actor2.handle) && (!actor2.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor2.handle);
                    }
                }
                break;
            }
            }
        }
Exemple #6
0
        public void CalculateKDA(COMDT_GAME_INFO gameInfo)
        {
            CRoleInfo masterRoleInfo = this.GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "masterRoleInfo is null");
            if (masterRoleInfo != null)
            {
                PlayerKDA hostKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetHostKDA();

                if (hostKDA != null)
                {
                    int num  = 0;
                    int num2 = 0;
                    int num3 = 0;
                    int num4 = 0;
                    int num5 = 0;
                    int num6 = 0;
                    int num7 = 0;
                    IEnumerator <HeroKDA> enumerator = hostKDA.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        if (enumerator.Current != null)
                        {
                            num  += enumerator.Current.LegendaryNum;
                            num2 += enumerator.Current.PentaKillNum;
                            num3 += enumerator.Current.QuataryKillNum;
                            num4 += enumerator.Current.TripleKillNum;
                            num5 += enumerator.Current.DoubleKillNum;
                        }
                    }
                    if (gameInfo.bGameResult == 1)
                    {
                        uint mvpPlayer = Singleton <BattleStatistic> .instance.GetMvpPlayer(hostKDA.PlayerCamp, true);

                        if (mvpPlayer != 0)
                        {
                            num6 = (mvpPlayer != hostKDA.PlayerId) ? 0 : 1;
                        }
                    }
                    else if (gameInfo.bGameResult == 2)
                    {
                        uint num9 = Singleton <BattleStatistic> .instance.GetMvpPlayer(hostKDA.PlayerCamp, false);

                        if (num9 != 0)
                        {
                            num7 = (num9 != hostKDA.PlayerId) ? 0 : 1;
                        }
                    }
                    bool flag  = false;
                    bool flag2 = false;
                    bool flag3 = false;
                    bool flag4 = false;
                    bool flag5 = false;
                    bool flag6 = false;
                    bool flag7 = false;
                    int  index = 0;
                    ListView <COMDT_STATISTIC_KEY_VALUE_INFO> inList = new ListView <COMDT_STATISTIC_KEY_VALUE_INFO>();
                    while (index < masterRoleInfo.pvpDetail.stKVDetail.dwNum)
                    {
                        COMDT_STATISTIC_KEY_VALUE_INFO comdt_statistic_key_value_info = masterRoleInfo.pvpDetail.stKVDetail.astKVDetail[index];
                        switch (((RES_STATISTIC_SETTLE_DATA_TYPE)comdt_statistic_key_value_info.dwKey))
                        {
                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_MVP_CNT:
                            comdt_statistic_key_value_info.dwValue += (uint)num6;
                            flag6 = true;
                            break;

                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_LOSE_SOUL:
                            comdt_statistic_key_value_info.dwValue += (uint)num7;
                            flag7 = true;
                            break;

                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_GODLIKE_CNT:
                            comdt_statistic_key_value_info.dwValue += (uint)num;
                            flag5 = true;
                            break;

                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_DOUBLE_KILL_CNT:
                            comdt_statistic_key_value_info.dwValue += (uint)num5;
                            flag = true;
                            break;

                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_TRIPLE_KILL_CNT:
                            comdt_statistic_key_value_info.dwValue += (uint)num4;
                            flag2 = true;
                            break;

                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_QUATARY_KILL_CNT:
                            comdt_statistic_key_value_info.dwValue += (uint)num3;
                            flag3 = true;
                            break;

                        case RES_STATISTIC_SETTLE_DATA_TYPE.RES_STATISTIC_SETTLE_DATA_TYPE_PENTA_KILL_CNT:
                            comdt_statistic_key_value_info.dwValue += (uint)num2;
                            flag4 = true;
                            break;
                        }
                        index++;
                    }
                    COMDT_STATISTIC_KEY_VALUE_INFO item = null;
                    if (!flag)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x10,
                            dwValue = (uint)num5
                        };
                        inList.Add(item);
                    }
                    if (!flag2)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x11,
                            dwValue = (uint)num4
                        };
                        inList.Add(item);
                    }
                    if (!flag3)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x1b,
                            dwValue = (uint)num3
                        };
                        inList.Add(item);
                    }
                    if (!flag4)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 0x1c,
                            dwValue = (uint)num2
                        };
                        inList.Add(item);
                    }
                    if (!flag5)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 15,
                            dwValue = (uint)num
                        };
                        inList.Add(item);
                    }
                    if (!flag6)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 13,
                            dwValue = (uint)num6
                        };
                        inList.Add(item);
                    }
                    if (!flag7)
                    {
                        item = new COMDT_STATISTIC_KEY_VALUE_INFO {
                            dwKey   = 14,
                            dwValue = (uint)num7
                        };
                        inList.Add(item);
                    }
                    if (inList.Count > 0)
                    {
                        masterRoleInfo.pvpDetail.stKVDetail.dwNum += (uint)inList.Count;
                        inList.AddRange(masterRoleInfo.pvpDetail.stKVDetail.astKVDetail);
                        masterRoleInfo.pvpDetail.stKVDetail.astKVDetail = LinqS.ToArray <COMDT_STATISTIC_KEY_VALUE_INFO>(inList);
                    }
                }
            }
        }
Exemple #7
0
    private static Texture[] PreloadTexture(GameObject tarObj, List <GameObject> parentPrefabList)
    {
        if (!NcEffectBehaviour.IsSafe())
        {
            return(null);
        }
        Renderer[]         componentsInChildren = tarObj.GetComponentsInChildren <Renderer>(true);
        ListView <Texture> listView             = new ListView <Texture>();

        Renderer[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Renderer renderer = array[i];
            if (renderer.sharedMaterials != null && renderer.sharedMaterials.Length > 0)
            {
                Material[] sharedMaterials = renderer.sharedMaterials;
                for (int j = 0; j < sharedMaterials.Length; j++)
                {
                    Material material = sharedMaterials[j];
                    if (material != null && material.mainTexture != null)
                    {
                        listView.Add(material.mainTexture);
                    }
                }
            }
        }
        NcSpriteTexture[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true);
        NcSpriteTexture[] array2 = componentsInChildren2;
        for (int k = 0; k < array2.Length; k++)
        {
            NcSpriteTexture ncSpriteTexture = array2[k];
            if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null)
            {
                Texture[] array3 = NcEffectBehaviour.PreloadPrefab(ncSpriteTexture.m_NcSpriteFactoryPrefab, parentPrefabList, false);
                if (array3 != null)
                {
                    listView.AddRange(array3);
                }
            }
        }
        NcSpriteFactory[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true);
        NcSpriteFactory[] array4 = componentsInChildren3;
        for (int l = 0; l < array4.Length; l++)
        {
            NcSpriteFactory ncSpriteFactory = array4[l];
            if (ncSpriteFactory.m_SpriteList != null)
            {
                for (int m = 0; m < ncSpriteFactory.m_SpriteList.get_Count(); m++)
                {
                    if (ncSpriteFactory.m_SpriteList.get_Item(m).m_EffectPrefab != null)
                    {
                        Texture[] array5 = NcEffectBehaviour.PreloadPrefab(ncSpriteFactory.m_SpriteList.get_Item(m).m_EffectPrefab, parentPrefabList, true);
                        if (array5 == null)
                        {
                            ncSpriteFactory.m_SpriteList.get_Item(m).m_EffectPrefab = null;
                        }
                        else
                        {
                            listView.AddRange(array5);
                        }
                        if (ncSpriteFactory.m_SpriteList.get_Item(m).m_AudioClip != null)
                        {
                        }
                    }
                }
            }
        }
        return(LinqS.ToArray <Texture>(listView));
    }
Exemple #8
0
        private static void RegisterMetas(Assembly a)
        {
            ListView <Type> listView = new ListView <Type>();

            Type[] types = a.GetTypes();
            Type[] array = types;
            for (int i = 0; i < array.Length; i++)
            {
                Type type3 = array[i];
                if ((type3.IsSubclassOf(typeof(Agent)) || Utils.IsStaticType(type3)) && !Workspace.IsRegisterd(type3))
                {
                    Attribute[] array2 = (Attribute[])type3.GetCustomAttributes(typeof(TypeMetaInfoAttribute), false);
                    if (array2.Length > 0)
                    {
                        Workspace.TypeInfo_t typeInfo_t = new Workspace.TypeInfo_t();
                        typeInfo_t.type = type3;
                        Workspace.ms_agentTypes.Add(typeInfo_t);
                        if (type3.get_BaseType() != null && (type3.get_BaseType() == typeof(Agent) || type3.get_BaseType().IsSubclassOf(typeof(Agent))))
                        {
                            listView.Add(type3.get_BaseType());
                        }
                        if (Utils.IsStaticType(type3))
                        {
                            TypeMetaInfoAttribute typeMetaInfoAttribute = array2[0] as TypeMetaInfoAttribute;
                            Agent.RegisterStaticClass(type3, typeMetaInfoAttribute.DisplayName, typeMetaInfoAttribute.Description);
                        }
                    }
                }
            }
            using (ListView <Type> .Enumerator enumerator = listView.GetEnumerator())
            {
                Type type;
                while (enumerator.MoveNext())
                {
                    type = enumerator.get_Current();
                    if (!Workspace.IsRegisterd(type) && Workspace.ms_agentTypes.Find((Workspace.TypeInfo_t t) => t.type == type) == null)
                    {
                        Workspace.TypeInfo_t typeInfo_t2 = new Workspace.TypeInfo_t();
                        typeInfo_t2.type         = type;
                        typeInfo_t2.bIsInherited = true;
                        Workspace.ms_agentTypes.Add(typeInfo_t2);
                    }
                }
            }
            Workspace.ms_agentTypes.Sort(delegate(Workspace.TypeInfo_t x, Workspace.TypeInfo_t y)
            {
                if (x.bIsInherited && !y.bIsInherited)
                {
                    return(-1);
                }
                if (!x.bIsInherited && y.bIsInherited)
                {
                    return(1);
                }
                if (x.type.IsSubclassOf(y.type))
                {
                    return(1);
                }
                if (y.type.IsSubclassOf(x.type))
                {
                    return(-1);
                }
                return(x.type.get_FullName().CompareTo(y.type.get_FullName()));
            });
            using (List <Workspace.TypeInfo_t> .Enumerator enumerator2 = Workspace.ms_agentTypes.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    Workspace.TypeInfo_t current = enumerator2.get_Current();
                    Type type2 = current.type;
                    Workspace.RegisterType(type2, true);
                }
            }
        }
    private bool RefreshData()
    {
        CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

        DebugHelper.Assert(masterRoleInfo != null, "Owned::Master Role Info Is Null");
        this.m_HotSaleListView.Clear();
        this.m_NewArrivalListView.Clear();
        DictionaryView <uint, ResBoutiqueConf> .Enumerator enumerator = GameDataMgr.boutiqueDict.GetEnumerator();
        int currentUTCTime = CRoleInfo.GetCurrentUTCTime();

        while (enumerator.MoveNext())
        {
            KeyValuePair <uint, ResBoutiqueConf> current = enumerator.Current;
            ResBoutiqueConf value = current.get_Value();
            if ((ulong)value.dwOnTimeGen <= (ulong)((long)currentUTCTime) && (ulong)value.dwOffTimeGen >= (ulong)((long)currentUTCTime))
            {
                RES_BOUTIQUE_TYPE          bBoutiqueType     = (RES_BOUTIQUE_TYPE)value.bBoutiqueType;
                ListView <ResBoutiqueConf> listView          = null;
                RES_BOUTIQUE_TYPE          rES_BOUTIQUE_TYPE = bBoutiqueType;
                if (rES_BOUTIQUE_TYPE != RES_BOUTIQUE_TYPE.RES_BOUTIQUE_TYPE_NEW_ARRIVAL)
                {
                    if (rES_BOUTIQUE_TYPE == RES_BOUTIQUE_TYPE.RES_BOUTIQUE_TYPE_HOT_SALE)
                    {
                        listView = this.m_HotSaleListView;
                    }
                }
                else
                {
                    listView = this.m_NewArrivalListView;
                }
                switch (value.wItemType)
                {
                case 2:
                case 5:
                {
                    CMallFactoryShopController.ShopProduct product = Singleton <CMallFactoryShopController> .GetInstance().GetProduct(value.dwItemID);

                    if (product != null && product.IsOnSale == 1 && listView != null)
                    {
                        listView.Add(value);
                    }
                    break;
                }

                case 4:
                {
                    ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(value.dwItemID);
                    if (dataByKey != null && GameDataMgr.IsHeroAvailable(dataByKey.dwCfgID) && listView != null)
                    {
                        listView.Add(value);
                    }
                    break;
                }

                case 7:
                {
                    ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(value.dwItemID);
                    if (heroSkin != null)
                    {
                        ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID);
                        if (dataByKey2 != null)
                        {
                            bool flag = true;
                            if (masterRoleInfo != null)
                            {
                                flag = masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false);
                            }
                            if (GameDataMgr.IsSkinAvailable(heroSkin.dwID) && !flag && GameDataMgr.IsHeroAvailable(dataByKey2.dwCfgID) && listView != null)
                            {
                                listView.Add(value);
                            }
                        }
                    }
                    break;
                }
                }
            }
        }
        return(true);
    }
Exemple #10
0
 public static T[] AddElement<T>(T[] elements, T element)
 {
     ListView<T> inList = new ListView<T>(elements);
     inList.Add(element);
     return LinqS.ToArray<T>(inList);
 }
Exemple #11
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, uint discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root     = formScript.gameObject;
                this._usb      = CUseableManager.CreateUseable(type, id, 0);
                this._count    = 1;
                this._maxCount = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._discount         = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randowmRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                CHeroItem item2          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item2.m_heroData.dwCfgID))
                                {
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }
Exemple #12
0
        public static ListView <UrlAction> ParseFromText(string text, char[] spliter = null)
        {
            ListView <UrlAction> listView = new ListView <UrlAction>();

            if (spliter == null)
            {
                spliter = UrlAction.MultiSpliter;
            }
            try
            {
                string[] array = text.Split(spliter, 1);
                for (int i = 0; i < array.Length; i++)
                {
                    string[] array2 = array[i].Split(UrlAction.InnerSpliter, 1);
                    if (array2.Length > 0)
                    {
                        DictionaryView <string, string> dictionaryView = new DictionaryView <string, string>();
                        for (int j = 1; j < array2.Length; j++)
                        {
                            string[] array3 = array2[j].Split(UrlAction.ParamSpliter);
                            if (array3 != null && array3.Length == 2)
                            {
                                dictionaryView.Add(array3[0], array3[1]);
                            }
                        }
                        UrlAction urlAction = new UrlAction();
                        urlAction.target = array2[0];
                        urlAction.action = UrlAction.Action.none;
                        if (dictionaryView.ContainsKey("action"))
                        {
                            string text2 = dictionaryView.get_Item("action");
                            string text3 = text2;
                            if (text3 != null)
                            {
                                if (UrlAction.< > f__switch$map0 == null)
                                {
                                    Dictionary <string, int> dictionary = new Dictionary <string, int>(3);
                                    dictionary.Add("openUrl", 0);
                                    dictionary.Add("openForm", 1);
                                    dictionary.Add("buy", 2);
                                    UrlAction.< > f__switch$map0 = dictionary;
                                }
                                int num;
                                if (UrlAction.< > f__switch$map0.TryGetValue(text3, ref num))
                                {
                                    switch (num)
                                    {
                                    case 0:
                                        urlAction.action = UrlAction.Action.openUrl;
                                        urlAction.url    = dictionaryView.get_Item("url");
                                        break;

                                    case 1:
                                        urlAction.action = UrlAction.Action.openForm;
                                        urlAction.form   = int.Parse(dictionaryView.get_Item("form"));
                                        break;

                                    case 2:
                                        urlAction.action   = UrlAction.Action.buy;
                                        urlAction.prodType = int.Parse(dictionaryView.get_Item("prodType"));
                                        urlAction.prodID   = uint.Parse(dictionaryView.get_Item("prodID"));
                                        if (dictionaryView.ContainsKey("prodSpec"))
                                        {
                                            int.TryParse(dictionaryView.get_Item("prodSpec"), ref urlAction.prodSpec);
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                        if (dictionaryView.ContainsKey("overTime"))
                        {
                            ulong.TryParse(dictionaryView.get_Item("overTime"), ref urlAction.overTime);
                        }
                        if (dictionaryView.ContainsKey("showTime"))
                        {
                            int.TryParse(dictionaryView.get_Item("showTime"), ref urlAction.showTime);
                        }
                        listView.Add(urlAction);
                    }
                }
            }
            catch (Exception var_9_25C)
            {
            }
            return(listView);
        }
Exemple #13
0
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors;
                int count = heroActors.Count;
                for (int i = 0; i < count; i++)
                {
                    PoolObjHandle <ActorRoot> handle3 = heroActors[i];
                    if (handle3.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp)
                    {
                        PoolObjHandle <ActorRoot> handle4 = heroActors[i];
                        if (handle4.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                        {
                            PoolObjHandle <ActorRoot> handle5 = heroActors[i];
                            if (!handle5.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                            {
                                PoolObjHandle <ActorRoot> handle6 = heroActors[i];
                                relatedHeros.Add(handle6.handle);
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE:
            {
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                List <PoolObjHandle <ActorRoot> > list2 = Singleton <GameObjMgr> .instance.HeroActors;
                int num3 = list2.Count;
                for (int j = 0; j < num3; j++)
                {
                    if (list2[j] != attacker)
                    {
                        PoolObjHandle <ActorRoot> handle7 = list2[j];
                        if (handle7.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp)
                        {
                            PoolObjHandle <ActorRoot> handle8 = list2[j];
                            if ((handle8.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && this.IsActorInRange(list2[j], target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius))
                            {
                                PoolObjHandle <ActorRoot> handle9 = list2[j];
                                if (!handle9.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                                {
                                    PoolObjHandle <ActorRoot> handle10 = list2[j];
                                    relatedHeros.Add(handle10.handle);
                                }
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL:
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                break;

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST:
            {
                HashSet <uint> .Enumerator enumerator = BattleLogic.GetAssistSet(target, attacker, true).GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.Current);

                    if ((actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!actor.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                    {
                        relatedHeros.Add(actor.handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL:
            {
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                HashSet <uint> .Enumerator enumerator2 = BattleLogic.GetAssistSet(target, attacker, true).GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PoolObjHandle <ActorRoot> handle2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.Current);

                    if (((handle2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && !relatedHeros.Contains(handle2.handle)) && (!handle2.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                    {
                        relatedHeros.Add(handle2.handle);
                    }
                }
                break;
            }
            }
        }
        public ListView <GameReplayModule.ReplayFileInfo> ListReplayFiles(bool removeObsolete = true)
        {
            ListView <GameReplayModule.ReplayFileInfo> listView = new ListView <GameReplayModule.ReplayFileInfo>();
            string        replayFolder  = GameReplayModule.ReplayFolder;
            DirectoryInfo directoryInfo = new DirectoryInfo(replayFolder);

            if (directoryInfo.get_Exists())
            {
                string[] files = Directory.GetFiles(directoryInfo.get_FullName(), "*.ab?", 0);
                for (int i = files.Length - 1; i >= 0; i--)
                {
                    try
                    {
                        string       text         = files[i];
                        FileStream   fileStream   = new FileStream(text, 3, 1);
                        BinaryReader binaryReader = new BinaryReader(fileStream);
                        if (text.EndsWith(".abc"))
                        {
                            string appVersion          = binaryReader.ReadString();
                            string usedResourceVersion = binaryReader.ReadString();
                            binaryReader.ReadString();
                            listView.Add(new GameReplayModule.ReplayFileInfo
                            {
                                isExpired     = !CVersion.IsSynchronizedVersion(appVersion, usedResourceVersion),
                                path          = text,
                                heroId        = binaryReader.ReadUInt32(),
                                startTime     = binaryReader.ReadInt64(),
                                mapType       = binaryReader.ReadByte(),
                                mapId         = binaryReader.ReadUInt32(),
                                userName      = binaryReader.ReadString(),
                                userHead      = binaryReader.ReadString(),
                                userRankGrade = binaryReader.ReadByte(),
                                userRankClass = binaryReader.ReadUInt32()
                            });
                        }
                        else
                        {
                            int num  = binaryReader.ReadInt32();
                            int num2 = 0;
                            binaryReader.Read(this.streamBuffer, 0, num);
                            this.replayAbsHeader.unpack(ref this.streamBuffer, num, ref num2, 0u);
                            string versionString  = CVersion.GetVersionString(this.replayAbsHeader.iAppVersion);
                            string versionString2 = CVersion.GetVersionString(this.replayAbsHeader.iResVersion);
                            listView.Add(new GameReplayModule.ReplayFileInfo
                            {
                                isExpired     = !CVersion.IsSynchronizedVersion(versionString, versionString2),
                                path          = text,
                                heroId        = this.replayAbsHeader.dwHeroID,
                                startTime     = (long)this.replayAbsHeader.ullTime,
                                mapType       = this.replayAbsHeader.bMapType,
                                mapId         = this.replayAbsHeader.dwMapId,
                                userName      = StringHelper.UTF8BytesToString(ref this.replayAbsHeader.szName),
                                userHead      = StringHelper.UTF8BytesToString(ref this.replayAbsHeader.szHeadUrl),
                                userRankGrade = this.replayAbsHeader.bRankGrade,
                                userRankClass = this.replayAbsHeader.dwRankClass
                            });
                        }
                        binaryReader.Close();
                        fileStream.Close();
                        if (removeObsolete)
                        {
                            File.Delete(text);
                        }
                    }
                    catch
                    {
                    }
                }
            }
            return(listView);
        }
Exemple #15
0
        public static void OnRankGodDetailTab(int tabIndex, COMDT_RANKING_LIST_ITEM_EXTRA_MASTER_HERO masterHeroInfo, uint heroId)
        {
            CUIFormScript form = Singleton <CUIManager> .get_instance().GetForm(RankingSystem.s_rankingGodDetailForm);

            if (form == null)
            {
                return;
            }
            GameObject widget = form.GetWidget(0);

            if (widget == null)
            {
                return;
            }
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);

            if (dataByKey == null)
            {
                return;
            }
            GameObject gameObject  = Utility.FindChild(widget, "Panel_EquipInfo");
            GameObject gameObject2 = Utility.FindChild(widget, "Panel_SymbolInfo");
            string     text        = Utility.UTF8Convert(masterHeroInfo.stAcntInfo.szPlayerName);
            string     szName      = dataByKey.szName;

            gameObject.CustomSetActive(false);
            gameObject2.CustomSetActive(false);
            if (tabIndex == 0)
            {
                gameObject.CustomSetActive(true);
                CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(gameObject, "List");
                int           num             = (int)masterHeroInfo.stEquipList.bEquipNum;
                ushort[]      array           = new ushort[6];
                if (num > 0)
                {
                    for (int i = 0; i < num; i++)
                    {
                        array[i] = (ushort)masterHeroInfo.stEquipList.EquipID[i];
                    }
                }
                else
                {
                    ResRecommendEquipInBattle defaultRecommendEquipInfo = Singleton <CEquipSystem> .get_instance().GetDefaultRecommendEquipInfo(heroId, 1u);

                    if (defaultRecommendEquipInfo != null)
                    {
                        array = defaultRecommendEquipInfo.RecommendEquipID;
                    }
                    num = array.Length;
                }
                componetInChild.SetElementAmount(num);
                for (int j = 0; j < num; j++)
                {
                    GameObject     gameObject3 = componetInChild.GetElemenet(j).gameObject;
                    CUIEventScript component   = gameObject3.GetComponent <CUIEventScript>();
                    ushort         num2        = array[j];
                    CEquipInfo     equipInfo   = CEquipSystem.GetEquipInfo(num2);
                    component.m_onClickEventParams.battleEquipPar.equipInfo = CEquipSystem.GetEquipInfo(num2);
                    component.m_onClickEventParams.tagStr  = text;
                    component.m_onClickEventParams.tagStr1 = szName;
                    CUICommonSystem.SetEquipIcon(num2, gameObject3, form);
                }
                if (num > 0)
                {
                    componetInChild.SelectElement(0, true);
                    componetInChild.GetElemenet(0).GetComponent <CUIEventScript>().OnPointerClick(null);
                    CUIEventScript component2 = componetInChild.GetElemenet(0).GetComponent <CUIEventScript>();
                    Singleton <CUIEventManager> .get_instance().DispatchUIEvent(component2.m_onClickEventID, component2.m_onClickEventParams);
                }
                else
                {
                    componetInChild.SelectElement(-1, true);
                }
            }
            else if (tabIndex == 1)
            {
                ListView <CSymbolItem> listView = new ListView <CSymbolItem>();
                for (int k = 0; k < (int)masterHeroInfo.stSymbolPageInfo.bSymbolPosNum; k++)
                {
                    bool flag = false;
                    for (int l = 0; l < listView.get_Count(); l++)
                    {
                        if (listView.get_Item(l).m_baseID == masterHeroInfo.stSymbolPageInfo.SymbolId[k])
                        {
                            listView.get_Item(l).m_stackCount++;
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        CSymbolItem cSymbolItem = CUseableManager.CreateUseable(5, masterHeroInfo.stSymbolPageInfo.SymbolId[k], 1) as CSymbolItem;
                        listView.Add(cSymbolItem);
                    }
                }
                CSymbolWearController.SortSymbolList(ref listView);
                gameObject2.CustomSetActive(true);
                CUIListScript componetInChild2 = Utility.GetComponetInChild <CUIListScript>(gameObject2, "List");
                componetInChild2.SetElementAmount(listView.get_Count());
                int num3 = 0;
                for (int m = 0; m < listView.get_Count(); m++)
                {
                    GameObject gameObject4      = componetInChild2.GetElemenet(m).gameObject;
                    Image      componetInChild3 = Utility.GetComponetInChild <Image>(gameObject4, "imgIcon");
                    componetInChild3.SetSprite(listView.get_Item(m).GetIconPath(), form, true, false, false, false);
                    Text componetInChild4 = Utility.GetComponetInChild <Text>(gameObject4, "SymbolName");
                    componetInChild4.text = listView.get_Item(m).m_name;
                    Text componetInChild5 = Utility.GetComponetInChild <Text>(gameObject4, "SymbolDesc");
                    componetInChild5.text = CSymbolSystem.GetSymbolAttString(listView.get_Item(m), true).TrimEnd(new char[]
                    {
                        '\n'
                    });
                    Text componetInChild6 = Utility.GetComponetInChild <Text>(gameObject4, "lblIconCount");
                    componetInChild6.text = string.Format("x{0}", listView.get_Item(m).m_stackCount);
                    num3 += (int)listView.get_Item(m).m_SymbolData.wLevel *listView.get_Item(m).m_stackCount;
                }
                Utility.GetComponetInChild <Text>(gameObject2, "symbolPageLvlText").text = num3.ToString();
                Utility.GetComponetInChild <Text>(gameObject2, "heroSymbolText").text    = Singleton <CTextManager> .get_instance().GetText("RankGodHeroSymbolDesc", new string[]
                {
                    text,
                    szName
                });
            }
        }
Exemple #16
0
        public static ListView <CUseable> GetUseableListFromReward(COMDT_REWARD_DETAIL reward)
        {
            ListView <CUseable> view = new ListView <CUseable>();

            for (int i = 0; i < reward.bNum; i++)
            {
                CUseable useable;
                switch (reward.astRewardDetail[i].bType)
                {
                case 0:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwCoin, 0);
                    view.Add(useable);
                    continue;
                }

                case 1:
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stItem.dwCnt, reward.astRewardDetail[i].stRewardInfo.stItem.dwItemID);
                    if (useable == null)
                    {
                        continue;
                    }
                    if (reward.astRewardDetail[i].bFromType != 1)
                    {
                        break;
                    }
                    useable.ExtraFromType = reward.astRewardDetail[i].bFromType;
                    useable.ExtraFromData = (int)reward.astRewardDetail[i].stFromInfo.stHeroInfo.dwHeroID;
                    goto Label_02AA;

                case 2:
                case 15:
                {
                    continue;
                }

                case 3:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwCoupons, 0);
                    view.Add(useable);
                    continue;
                }

                case 4:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stEquip.dwCnt, reward.astRewardDetail[i].stRewardInfo.stEquip.dwEquipID);
                    view.Add(useable);
                    continue;
                }

                case 5:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stHero.dwCnt, reward.astRewardDetail[i].stRewardInfo.stHero.dwHeroID);
                    view.Add(useable);
                    continue;
                }

                case 6:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stSymbol.dwCnt, reward.astRewardDetail[i].stRewardInfo.stSymbol.dwSymbolID);
                    view.Add(useable);
                    continue;
                }

                case 7:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwBurningCoin, 0);
                    view.Add(useable);
                    continue;
                }

                case 8:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwArenaCoin, 0);
                    view.Add(useable);
                    continue;
                }

                case 9:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwAP, 0);
                    view.Add(useable);
                    continue;
                }

                case 10:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stSkin.dwCnt, reward.astRewardDetail[i].stRewardInfo.stSkin.dwSkinID);
                    view.Add(useable);
                    continue;
                }

                case 11:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwPvpCoin, 0);
                    view.Add(useable);
                    continue;
                }

                case 12:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwHeroPoolExp, 0);
                    view.Add(useable);
                    continue;
                }

                case 13:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwSkinCoin, 0);
                    view.Add(useable);
                    continue;
                }

                case 14:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwSymbolCoin, 0);
                    if (useable != null)
                    {
                        view.Add(useable);
                    }
                    continue;
                }

                case 0x10:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwDiamond, 0);
                    view.Add(useable);
                    continue;
                }

                case 0x11:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwHuoYueDu, 0);
                    if (useable != null)
                    {
                        view.Add(useable);
                    }
                    continue;
                }

                case 0x12:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMatchPointPer, 0);
                    view.Add(useable);
                    continue;
                }

                case 0x13:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMatchPointGuild, 0);
                    view.Add(useable);
                    continue;
                }

                case 20:
                {
                    useable = CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, 1, reward.astRewardDetail[i].stRewardInfo.stHeadImage.dwHeadImgID);
                    if (useable != null)
                    {
                        view.Add(useable);
                    }
                    continue;
                }

                default:
                {
                    continue;
                }
                }
                if (reward.astRewardDetail[i].bFromType == 2)
                {
                    useable.ExtraFromType = reward.astRewardDetail[i].bFromType;
                    useable.ExtraFromData = (int)reward.astRewardDetail[i].stFromInfo.stSkinInfo.dwSkinID;
                }
Label_02AA:
                view.Add(useable);
            }
            return(view);
        }
Exemple #17
0
        public void CalculateKDA(COMDT_GAME_INFO gameInfo)
        {
            CRoleInfo masterRoleInfo = this.GetMasterRoleInfo();

            DebugHelper.Assert(masterRoleInfo != null, "masterRoleInfo is null");
            if (masterRoleInfo == null)
            {
                return;
            }
            PlayerKDA hostKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetHostKDA();

            if (hostKDA != null)
            {
                int num   = 0;
                int num2  = 0;
                int num3  = 0;
                int num4  = 0;
                int num5  = 0;
                int num6  = 0;
                int num7  = 0;
                int num8  = 0;
                int num9  = 0;
                int num10 = 0;
                int num11 = 0;
                int num12 = 0;
                ListView <HeroKDA> .Enumerator enumerator = hostKDA.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    if (enumerator.get_Current() != null)
                    {
                        num   += enumerator.get_Current().LegendaryNum;
                        num2  += enumerator.get_Current().PentaKillNum;
                        num3  += enumerator.get_Current().QuataryKillNum;
                        num4  += enumerator.get_Current().TripleKillNum;
                        num5  += enumerator.get_Current().DoubleKillNum;
                        num8  += ((!enumerator.get_Current().bHurtMost) ? 0 : 1);
                        num9  += ((!enumerator.get_Current().bHurtTakenMost) ? 0 : 1);
                        num10 += ((!enumerator.get_Current().bGetCoinMost) ? 0 : 1);
                        num11 += ((!enumerator.get_Current().bAsssistMost) ? 0 : 1);
                        num12 += ((!enumerator.get_Current().bKillMost) ? 0 : 1);
                    }
                }
                if (gameInfo.bGameResult == 1)
                {
                    uint mvpPlayer = Singleton <BattleStatistic> .get_instance().GetMvpPlayer(hostKDA.PlayerCamp, true);

                    if (mvpPlayer != 0u)
                    {
                        num6 = ((mvpPlayer != hostKDA.PlayerId) ? 0 : 1);
                    }
                }
                else if (gameInfo.bGameResult == 2)
                {
                    uint mvpPlayer2 = Singleton <BattleStatistic> .get_instance().GetMvpPlayer(hostKDA.PlayerCamp, false);

                    if (mvpPlayer2 != 0u)
                    {
                        num7 = ((mvpPlayer2 != hostKDA.PlayerId) ? 0 : 1);
                    }
                }
                bool flag   = false;
                bool flag2  = false;
                bool flag3  = false;
                bool flag4  = false;
                bool flag5  = false;
                bool flag6  = false;
                bool flag7  = false;
                bool flag8  = false;
                bool flag9  = false;
                bool flag10 = false;
                bool flag11 = false;
                bool flag12 = false;
                int  num13  = 0;
                ListView <COMDT_STATISTIC_KEY_VALUE_INFO> listView = new ListView <COMDT_STATISTIC_KEY_VALUE_INFO>();
                while ((long)num13 < (long)((ulong)masterRoleInfo.pvpDetail.stKVDetail.dwNum))
                {
                    COMDT_STATISTIC_KEY_VALUE_INFO cOMDT_STATISTIC_KEY_VALUE_INFO = masterRoleInfo.pvpDetail.stKVDetail.astKVDetail[num13];
                    switch (cOMDT_STATISTIC_KEY_VALUE_INFO.dwKey)
                    {
                    case 13u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num6;
                        flag6 = true;
                        break;

                    case 14u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num7;
                        flag7 = true;
                        break;

                    case 15u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num;
                        flag5 = true;
                        break;

                    case 16u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num5;
                        flag = true;
                        break;

                    case 17u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num4;
                        flag2 = true;
                        break;

                    case 27u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num3;
                        flag3 = true;
                        break;

                    case 28u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num2;
                        flag4 = true;
                        break;

                    case 29u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num8;
                        flag8 = true;
                        break;

                    case 30u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num10;
                        flag10 = true;
                        break;

                    case 31u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num9;
                        flag9 = true;
                        break;

                    case 32u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num11;
                        flag11 = true;
                        break;

                    case 33u:
                        cOMDT_STATISTIC_KEY_VALUE_INFO.dwValue += (uint)num12;
                        flag12 = true;
                        break;
                    }
                    num13++;
                }
                if (!flag)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 16u,
                        dwValue = (uint)num5
                    });
                }
                if (!flag2)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 17u,
                        dwValue = (uint)num4
                    });
                }
                if (!flag3)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 27u,
                        dwValue = (uint)num3
                    });
                }
                if (!flag4)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 28u,
                        dwValue = (uint)num2
                    });
                }
                if (!flag5)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 15u,
                        dwValue = (uint)num
                    });
                }
                if (!flag6)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 13u,
                        dwValue = (uint)num6
                    });
                }
                if (!flag7)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 14u,
                        dwValue = (uint)num7
                    });
                }
                if (!flag8)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 29u,
                        dwValue = (uint)num8
                    });
                }
                if (!flag9)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 31u,
                        dwValue = (uint)num9
                    });
                }
                if (!flag10)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 30u,
                        dwValue = (uint)num10
                    });
                }
                if (!flag11)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 32u,
                        dwValue = (uint)num11
                    });
                }
                if (!flag12)
                {
                    listView.Add(new COMDT_STATISTIC_KEY_VALUE_INFO
                    {
                        dwKey   = 33u,
                        dwValue = (uint)num12
                    });
                }
                if (listView.get_Count() > 0)
                {
                    masterRoleInfo.pvpDetail.stKVDetail.dwNum += (uint)listView.get_Count();
                    listView.AddRange(masterRoleInfo.pvpDetail.stKVDetail.astKVDetail);
                    masterRoleInfo.pvpDetail.stKVDetail.astKVDetail = LinqS.ToArray <COMDT_STATISTIC_KEY_VALUE_INFO>(listView);
                }
            }
        }
Exemple #18
0
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case 1:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .get_instance().HeroActors;

                int count = heroActors.get_Count();
                for (int i = 0; i < count; i++)
                {
                    if (heroActors.get_Item(i).get_handle().TheActorMeta.ActorCamp == attacker.get_handle().TheActorMeta.ActorCamp&& heroActors.get_Item(i).get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!heroActors.get_Item(i).get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(heroActors.get_Item(i).get_handle());
                    }
                }
                break;
            }

            case 2:
            {
                if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.get_handle());
                }
                List <PoolObjHandle <ActorRoot> > heroActors2 = Singleton <GameObjMgr> .get_instance().HeroActors;

                int count2 = heroActors2.get_Count();
                for (int j = 0; j < count2; j++)
                {
                    if (!(heroActors2.get_Item(j) == attacker))
                    {
                        if (heroActors2.get_Item(j).get_handle().TheActorMeta.ActorCamp == attacker.get_handle().TheActorMeta.ActorCamp&& heroActors2.get_Item(j).get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && this.IsActorInRange(heroActors2.get_Item(j), target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius) && (!heroActors2.get_Item(j).get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                        {
                            relatedHeros.Add(heroActors2.get_Item(j).get_handle());
                        }
                    }
                }
                break;
            }

            case 3:
                if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.get_handle());
                }
                break;

            case 4:
            {
                HashSet <uint>             assistSet  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator = assistSet.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.get_Current());

                    if (actor.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!actor.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor.get_handle());
                    }
                }
                break;
            }

            case 5:
            {
                if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.get_handle());
                }
                HashSet <uint>             assistSet2  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator2 = assistSet2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.get_Current());

                    if (actor2.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !relatedHeros.Contains(actor2.get_handle()) && (!actor2.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor2.get_handle());
                    }
                }
                break;
            }
            }
        }
Exemple #19
0
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResSoulExpAllocRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors;
                int count = heroActors.Count;
                for (int i = 0; i < count; i++)
                {
                    PoolObjHandle <ActorRoot> handle3 = heroActors[i];
                    if (handle3.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp)
                    {
                        PoolObjHandle <ActorRoot> handle4 = heroActors[i];
                        if (handle4.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                        {
                            PoolObjHandle <ActorRoot> handle5 = heroActors[i];
                            if (!handle5.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                            {
                                PoolObjHandle <ActorRoot> handle6 = heroActors[i];
                                relatedHeros.Add(handle6.handle);
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE:
            {
                List <PoolObjHandle <ActorRoot> > list2 = Singleton <GameObjMgr> .instance.HeroActors;
                int num3 = list2.Count;
                for (int j = 0; j < num3; j++)
                {
                    PoolObjHandle <ActorRoot> handle7 = list2[j];
                    if (handle7.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp)
                    {
                        PoolObjHandle <ActorRoot> handle8 = list2[j];
                        if ((handle8.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && this.IsActorInRange(list2[j], target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius))
                        {
                            PoolObjHandle <ActorRoot> handle9 = list2[j];
                            if (!handle9.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                            {
                                PoolObjHandle <ActorRoot> handle10 = list2[j];
                                relatedHeros.Add(handle10.handle);
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL:
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                break;

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST:
            {
                int num5 = target.handle.ActorControl.hurtSelfActorList.Count;
                for (int k = 0; k < num5; k++)
                {
                    KeyValuePair <uint, ulong> pair  = target.handle.ActorControl.hurtSelfActorList[k];
                    PoolObjHandle <ActorRoot>  actor = Singleton <GameObjMgr> .GetInstance().GetActor(pair.Key);

                    if ((actor != attacker) && ((actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!actor.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))))
                    {
                        relatedHeros.Add(actor.handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL:
            {
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                int num7 = target.handle.ActorControl.hurtSelfActorList.Count;
                for (int m = 0; m < num7; m++)
                {
                    KeyValuePair <uint, ulong> pair2   = target.handle.ActorControl.hurtSelfActorList[m];
                    PoolObjHandle <ActorRoot>  handle2 = Singleton <GameObjMgr> .GetInstance().GetActor(pair2.Key);

                    if (((handle2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && !relatedHeros.Contains(handle2.handle)) && (!handle2.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                    {
                        relatedHeros.Add(handle2.handle);
                    }
                }
                break;
            }
            }
        }
Exemple #20
0
        public DNSErrCode Query(string domainName, ProcessQueryResult process, string OId, string SId, string version, string userData)
        {
            QueryValue value2;

            if (this.mInitStatus != DNSErrCode.DNS_NO_ERROR)
            {
                this.DNS_LOG_ERROR("init failed or uninit");
                this.mErrCode   = this.mInitStatus;
                this.mErrString = "init failed or uninit";
                return(this.mInitStatus);
            }
            if ((domainName == null) || (domainName.Length == 0))
            {
                this.DNS_LOG_ERROR("domainName is null");
                this.mErrCode   = DNSErrCode.DNS_INPUT_PARAM_ERROR;
                this.mErrString = "domainName is null";
                return(DNSErrCode.DNS_INPUT_PARAM_ERROR);
            }
            if (process == null)
            {
                this.DNS_LOG_ERROR("delegate function is null");
                this.mErrCode   = DNSErrCode.DNS_INPUT_PARAM_ERROR;
                this.mErrString = "delegate function is null";
                return(DNSErrCode.DNS_INPUT_PARAM_ERROR);
            }
            this.DNS_LOG_INFO(string.Format("domainName is [{0}]", domainName));
            this.mUploadeDomainName = string.Empty;
            if ((((OId != null) || (version != null)) || (userData != null)) && ((SId == null) || (SId.Length == 0)))
            {
                this.DNS_LOG_ERROR("OId, version or userData is not null but the SId is null");
                this.mErrCode   = DNSErrCode.DNS_INPUT_PARAM_ERROR;
                this.mErrString = "OId, version or userData is not null but the SId is null";
                return(DNSErrCode.DNS_INPUT_PARAM_ERROR);
            }
            if ((OId != null) && (OId.Length != 0))
            {
                this.mUploadeUserInfo = this.mUploadeUserInfo + ":" + OId;
            }
            else
            {
                this.mUploadeUserInfo = this.mUploadeUserInfo + ":N";
            }
            if ((SId != null) && (SId.Length != 0))
            {
                this.mUploadeUserInfo = this.mUploadeUserInfo + ":" + SId;
            }
            else
            {
                this.mUploadeUserInfo = this.mUploadeUserInfo + ":N";
            }
            if ((version != null) && (version.Length != 0))
            {
                this.mUploadeUserInfo = this.mUploadeUserInfo + ":" + version;
            }
            else
            {
                this.mUploadeUserInfo = this.mUploadeUserInfo + ":N";
            }
            char[]        separator      = new char[] { '|' };
            string[]      strArray       = domainName.Split(separator);
            List <string> domainNameList = new List <string>();

            foreach (string str in strArray)
            {
                if ((str.Length != 0) && !domainNameList.Contains(str))
                {
                    domainNameList.Add(str);
                }
            }
            if (domainNameList.Count == 0)
            {
                this.DNS_LOG_ERROR("all domainNames is empty");
                this.mErrCode   = DNSErrCode.DNS_INPUT_PARAM_ERROR;
                this.mErrString = "all domainNames is empty";
                return(DNSErrCode.DNS_INPUT_PARAM_ERROR);
            }
            if (10 < domainNameList.Count)
            {
                this.DNS_LOG_ERROR("more then ten domainNames in the list");
                this.mErrCode   = DNSErrCode.DNS_TOOMANY_DOMAINNAMES;
                this.mErrString = "more then ten domainNames in the list";
                return(DNSErrCode.DNS_TOOMANY_DOMAINNAMES);
            }
            this.DNS_LOG_INFO("all param is legal");
            value2.errCode   = 0L;
            value2.errString = "no error";
            value2.value     = new ListView <DnValue>();
            List <string> subDomainNames = new List <string>();

            if ((this.mFileSys != null) && this.isCacheEnable)
            {
                this.DNS_LOG_INFO("search domainName in cache");
                this.SearchDomainNameInCache(domainNameList, ref value2, ref subDomainNames);
            }
            else
            {
                this.DNS_LOG_INFO("search all domainNames in DNS server");
                foreach (string str2 in domainNameList)
                {
                    subDomainNames.Add(str2);
                }
            }
            if (subDomainNames.Count == 0)
            {
                this.DNS_LOG_INFO("all domainName's IP exist in cache");
                this.UploadStatisticData();
                process(value2);
                return(DNSErrCode.DNS_NO_ERROR);
            }
            string str3 = string.Empty;

            for (int i = 0; i < (subDomainNames.Count - 1); i++)
            {
                str3 = str3 + subDomainNames[i] + "|";
            }
            str3 = str3 + subDomainNames[subDomainNames.Count - 1];
            this.DNS_LOG_INFO(string.Format("send to DNS server's domainNames are [{0}]", str3));
            DNSErrCode code = dns_Query(base.ObjectId, str3, OId, SId, version, userData);

            this.mErrCode = dns_GetErrorCode(base.ObjectId);
            IntPtr ptr = dns_GetErrorString(base.ObjectId);

            this.mErrString = Marshal.PtrToStringAnsi(ptr);
            if (code != DNSErrCode.DNS_NO_ERROR)
            {
                this.DNS_LOG_ERROR(string.Format("send request failed, error code is [{0}]", Convert.ToString(code)));
                foreach (string str4 in subDomainNames)
                {
                    DnValue value3;
                    value3.errCode    = 0x455L;
                    value3.errString  = "send request error";
                    value3.domainName = str4;
                    value3.IPList     = new List <string>();
                    value2.value.Add(value3);
                    if (0 < this.mUploadeDomainName.Length)
                    {
                        this.mUploadeDomainName = this.mUploadeDomainName + ":" + str4 + "_0";
                    }
                    else
                    {
                        this.mUploadeDomainName = this.mUploadeDomainName + str4 + "_0";
                    }
                }
                if (subDomainNames.Count == domainNameList.Count)
                {
                    value2.errCode   = 0x455L;
                    value2.errString = "send request error";
                }
                this.UploadStatisticData();
                process(value2);
                return(code);
            }
            if (this.callbackObjectDic.ContainsKey(str3))
            {
                this.callbackObjectDic[str3].Add(process);
            }
            else
            {
                ListView <ProcessQueryResult> view = new ListView <ProcessQueryResult>();
                view.Add(process);
                this.callbackObjectDic.Add(str3, view);
            }
            if (this.isCallbackMode)
            {
                process(value2);
                value2.value.Clear();
            }
            this.mInitDomainNameMap.Add(str3, value2);
            return(DNSErrCode.DNS_NO_ERROR);
        }
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, BuyPickDialog.OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, BuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null, bool bfromFactoyShop = false)
        {
            this.m_bShowBigIcon = (callContext != null && callContext.GetSpecialIconPath() != null);
            CUIFormScript cUIFormScript;

            if (this.m_bShowBigIcon)
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Big_Icon_Form_Path, false, true);
            }
            else
            {
                cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(BuyPickDialog.s_Gift_Form_Path, false, true);
            }
            if (null != cUIFormScript)
            {
                this._root                 = cUIFormScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1u;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0u;
                this._maxCount             = maxCount;
                if (this._maxCount == 0u)
                {
                    this._maxCount = 999u;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem cItem = new CItem(0uL, id, 0, 0);
                    uint  key   = (uint)cItem.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  listView  = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable cUseable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (cUseable != null)
                            {
                                listView.Add(cUseable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.set_text(string.IsNullOrEmpty(cItem.m_mallDescription) ? cItem.m_description : cItem.m_mallDescription);
                    }
                    uint num  = 0u;
                    int  num2 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem cItem2 = (CItem)this._usb;
                        if (cItem2 != null && cItem2.m_itemData != null && cItem2.m_itemData.bType == 4)
                        {
                            this._bDynamicCorrectPrice = (cItem2.m_itemData.EftParam[3] > 0f);
                        }
                    }
                    CUIListScript componetInChild = Utility.GetComponetInChild <CUIListScript>(cUIFormScript.gameObject, "Panel/itemGroup");
                    componetInChild.SetElementAmount(listView.Count);
                    for (int j = 0; j < listView.Count; j++)
                    {
                        CUIListElementScript elemenet = componetInChild.GetElemenet(j);
                        this.UpdateElement(elemenet, listView[j], this.m_bShowBigIcon);
                        if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                        {
                            this._bHeroSkinGift = true;
                            CHeroItem cHeroItem      = listView[j] as CHeroItem;
                            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo != null && masterRoleInfo.IsOwnHero(cHeroItem.m_heroData.dwCfgID))
                            {
                                num += CHeroInfo.GetHeroCost(cHeroItem.m_heroData.dwCfgID, coinType);
                                num2++;
                            }
                        }
                        else if (listView[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                        {
                            this._bHeroSkinGift = true;
                            CHeroSkin cHeroSkin       = listView[j] as CHeroSkin;
                            CRoleInfo masterRoleInfo2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                            if (masterRoleInfo2 != null && masterRoleInfo2.IsHaveHeroSkin(cHeroSkin.m_heroId, cHeroSkin.m_skinId, false))
                            {
                                num += CSkinInfo.GetHeroSkinCost(cHeroSkin.m_heroId, cHeroSkin.m_skinId, coinType);
                                num2++;
                            }
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false), false);
                    }
                    Text componetInChild2 = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild2.set_text(string.Empty);
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice         = this._usb.GetBuyPrice(coinType);
                        Button componetInChild3 = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num2 >= listView.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, false, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip"));
                            this._heroSkinGiftCost = 0u;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(componetInChild3, true, true);
                            componetInChild2.set_text(Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip"));
                            uint num3 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num, this._realDiscount);
                            if (buyPrice >= num && num3 >= buyPrice / 10u)
                            {
                                this._heroSkinGiftCost = num3;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10u;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnCloseForm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_ConfirmFactoryShopBuy, new CUIEventManager.OnUIEventHandler(this.OnConfirmFactoryShopBuy));

                this.ValidateDynamic();
            }
        }
        private Action InternalPlayAction(string _actionName, bool _autoPlay, bool _stopConflictAction, GameObject[] _gameObjects)
        {
            GameObject gameObject = null;

            for (int i = 0; i < _gameObjects.Length; i++)
            {
                GameObject gameObject2 = _gameObjects[i];
                if (!(gameObject2 == null) && this.objectReferenceSet.ContainsKey(gameObject2))
                {
                    gameObject = gameObject2;
                    break;
                }
            }
            if (gameObject && _stopConflictAction)
            {
                this.conflictActionsToStop.Clear();
                ListView <Action>             listView   = this.objectReferenceSet[gameObject];
                ListView <Action> .Enumerator enumerator = listView.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    Action current = enumerator.Current;
                    if (!current.unstoppable)
                    {
                        this.conflictActionsToStop.Add(current);
                    }
                }
                ListView <Action> .Enumerator enumerator2 = this.conflictActionsToStop.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    Action current2 = enumerator2.Current;
                    current2.Stop(false);
                }
            }
            Action action = this.LoadActionResource(_actionName);

            if (action == null)
            {
                Debug.LogError("Playing \"" + _actionName + "\" failed. Asset not found!");
                return(null);
            }
            Action action2 = ClassObjPool <Action> .Get();

            action2.enabled             = _autoPlay;
            action2.refGameObjectsCount = _gameObjects.Length;
            action2.LoadAction(action, _gameObjects);
            this.actionList.Add(action2);
            for (int j = 0; j < _gameObjects.Length; j++)
            {
                GameObject gameObject3 = _gameObjects[j];
                if (!(gameObject3 == null))
                {
                    ListView <Action> listView2 = null;
                    if (this.objectReferenceSet.TryGetValue(gameObject3, out listView2))
                    {
                        listView2.Add(action2);
                    }
                    else
                    {
                        listView2 = new ListView <Action>();
                        listView2.Add(action2);
                        this.objectReferenceSet.Add(gameObject3, listView2);
                    }
                }
            }
            return(action2);
        }
Exemple #23
0
    private void FiterImageNotice(ListView <NoticeSys.NoticeDataEx> datalist)
    {
        int count = datalist.Count;

        if (count > 0 && count <= 3)
        {
            for (int i = 0; i < count; i++)
            {
                NoticeSys.NoticeDataEx ex = datalist[i];
                this.SelectDatatoShow(ex);
            }
            return;
        }
        datalist.Sort(new NoticeSys.CNoticeDataExAscendingHelper());
        ListView <NoticeSys.NoticeDataEx> listView  = new ListView <NoticeSys.NoticeDataEx>();
        ListView <NoticeSys.NoticeDataEx> listView2 = new ListView <NoticeSys.NoticeDataEx>();

        for (int j = 0; j < datalist.Count; j++)
        {
            NoticeSys.NoticeDataEx noticeDataEx = datalist[j];
            if (noticeDataEx.playMode == NoticeSys.NoticePlayMode.Always)
            {
                string empty = string.Empty;
                string text  = "0";
                if (this.IsShowTimes(noticeDataEx.apolloNoticeData.MsgID, noticeDataEx.maxShowCount, out empty, out text))
                {
                    listView.Add(noticeDataEx);
                }
            }
            else if (noticeDataEx.playMode == NoticeSys.NoticePlayMode.Random)
            {
                string empty2 = string.Empty;
                string text2  = "0";
                if (this.IsShowTimes(noticeDataEx.apolloNoticeData.MsgID, noticeDataEx.maxShowCount, out empty2, out text2))
                {
                    listView2.Add(noticeDataEx);
                }
            }
        }
        int count2 = listView.Count;
        int count3 = listView2.Count;

        if (count2 <= 3)
        {
            for (int k = 0; k < count2; k++)
            {
                NoticeSys.NoticeDataEx ex2 = listView[k];
                this.SelectDatatoShow(ex2);
            }
            int num = 3 - count2;
            if (num > 0)
            {
                if (count3 <= num)
                {
                    for (int l = 0; l < count3; l++)
                    {
                        NoticeSys.NoticeDataEx ex3 = listView2[l];
                        this.SelectDatatoShow(ex3);
                    }
                }
                else
                {
                    List <int> list   = new List <int>(num);
                    Random     random = new Random();
                    while (list.get_Count() < num)
                    {
                        int num2 = random.Next(0, count3);
                        if (!list.Contains(num2))
                        {
                            list.Add(num2);
                        }
                    }
                    for (int m = 0; m < list.get_Count(); m++)
                    {
                        int num3 = list.get_Item(m);
                        if (num3 < count3)
                        {
                            NoticeSys.NoticeDataEx ex4 = listView2[num3];
                            this.SelectDatatoShow(ex4);
                        }
                    }
                }
            }
        }
        else
        {
            for (int n = 0; n < 3; n++)
            {
                if (n < count2)
                {
                    NoticeSys.NoticeDataEx ex5 = listView[n];
                    this.SelectDatatoShow(ex5);
                }
            }
        }
    }
Exemple #24
0
        public static ListView <CUseable> GetUseableListFromReward(COMDT_REWARD_DETAIL reward)
        {
            ListView <CUseable> listView = new ListView <CUseable>();
            int i = 0;

            while (i < (int)reward.bNum)
            {
                switch (reward.astRewardDetail[i].bType)
                {
                case 0:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwCoin, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 1:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.get_stItem().dwCnt, reward.astRewardDetail[i].stRewardInfo.get_stItem().dwItemID);
                    if (cUseable != null)
                    {
                        if (reward.astRewardDetail[i].bFromType == 1)
                        {
                            cUseable.ExtraFromType = (int)reward.astRewardDetail[i].bFromType;
                            cUseable.ExtraFromData = (int)reward.astRewardDetail[i].stFromInfo.get_stHeroInfo().dwHeroID;
                        }
                        else if (reward.astRewardDetail[i].bFromType == 2)
                        {
                            cUseable.ExtraFromType = (int)reward.astRewardDetail[i].bFromType;
                            cUseable.ExtraFromData = (int)reward.astRewardDetail[i].stFromInfo.get_stSkinInfo().dwSkinID;
                        }
                        listView.Add(cUseable);
                    }
                    break;
                }

                case 3:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwCoupons, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 4:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.get_stEquip().dwCnt, reward.astRewardDetail[i].stRewardInfo.get_stEquip().dwEquipID);
                    listView.Add(cUseable);
                    break;
                }

                case 5:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.get_stHero().dwCnt, reward.astRewardDetail[i].stRewardInfo.get_stHero().dwHeroID);
                    listView.Add(cUseable);
                    break;
                }

                case 6:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.get_stSymbol().dwCnt, reward.astRewardDetail[i].stRewardInfo.get_stSymbol().dwSymbolID);
                    listView.Add(cUseable);
                    break;
                }

                case 7:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwBurningCoin, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 8:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwArenaCoin, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 9:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwAP, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 10:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.get_stSkin().dwCnt, reward.astRewardDetail[i].stRewardInfo.get_stSkin().dwSkinID);
                    listView.Add(cUseable);
                    break;
                }

                case 11:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwPvpCoin, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 12:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwHeroPoolExp, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 13:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwSkinCoin, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 14:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwSymbolCoin, 0u);
                    if (cUseable != null)
                    {
                        listView.Add(cUseable);
                    }
                    break;
                }

                case 16:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwDiamond, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 17:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwHuoYueDu, 0u);
                    if (cUseable != null)
                    {
                        listView.Add(cUseable);
                    }
                    break;
                }

                case 18:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMatchPointPer, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 19:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMatchPointGuild, 0u);
                    listView.Add(cUseable);
                    break;
                }

                case 20:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, 1, reward.astRewardDetail[i].stRewardInfo.get_stHeadImage().dwHeadImgID);
                    if (cUseable != null)
                    {
                        listView.Add(cUseable);
                    }
                    break;
                }

                case 21:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwAchieve, 0u);
                    if (cUseable != null)
                    {
                        listView.Add(cUseable);
                    }
                    break;
                }

                case 22:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType(reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMasterPoint, 0u);
                    if (cUseable != null)
                    {
                        listView.Add(cUseable);
                    }
                    break;
                }
                }
IL_5E1:
                i++;
                continue;
                goto IL_5E1;
            }
            return(listView);
        }
Exemple #25
0
    private void RenderCatalogsPanel()
    {
        VisualElement body = rootVisualElement.Q <VisualElement>("body");

        body.Clear();
        catalogsVisualTree.CloneTree(body);

        ListView listView = body.Q <ListView>("CatalogsList");

        List <BaseCatalog> catalogs = new List <BaseCatalog>(MarketManager.catalogs);

        catalogs.Sort(NameComparer);
        for (int i = 0; i < catalogs.Count; i++)
        {
            Button button = new Button {
                text = catalogs[i].name
            };
            int index = i;
            button.clicked += () => OnCatalogSelected(catalogs[index]);

            button.AddManipulator(
                new ContextualMenuManipulator(
                    x =>
                    AddContextMenuOptions(
                        x.menu,
                        new []
            {
                new Tuple <string, Action>("ChangeID", () => ChangeCatalogName(catalogs[index])),
                new Tuple <string, Action>("Delete", () => DestroyCatalog(catalogs[index])),
            })));
            listView.Add(button);
        }

        Button newCatalogButton = new Button {
            text = "+"
        };

        newCatalogButton.clicked        += CreateNewCatalogRequest;
        newCatalogButton.style.width     = 25;
        newCatalogButton.style.height    = 25;
        newCatalogButton.style.alignSelf = new StyleEnum <Align>(Align.Center);
        listView.Add(newCatalogButton);

        ListView catalogContent = body.Q <ListView>("LeftContent");

        catalogContent.style.flexGrow = 1;
        catalogContent.contentContainer.style.flexDirection = new StyleEnum <FlexDirection>(FlexDirection.Row);
        catalogContent.contentContainer.style.flexWrap      = new StyleEnum <Wrap>(Wrap.Wrap);

        Label label = body.Q <Label>("CurrentCatalogLabel");

        if (_selectedCatalog != null)
        {
            label.text = _selectedCatalog.name;
            List <BaseProduct> baseProducts = new List <BaseProduct>(_selectedCatalog.Products);
            baseProducts.Sort(NameComparer);
            for (int i = 0; i < baseProducts.Count; i++)
            {
                int           localIndex    = i;
                VisualElement prodSelection = CreateProductSelectionButton(
                    baseProducts[i],
                    baseProduct => RemoveFrom(baseProduct, _selectedCatalog),
                    new []
                {
                    new Tuple <string, Action>("Preview", () => PreviewProduct(baseProducts[localIndex])),
                    new Tuple <string, Action>("Edit", () => GoToProductEdit(baseProducts[localIndex])),
                    new Tuple <string, Action>("Delete", () => DestroyProduct(baseProducts[localIndex]))
                });
                catalogContent.Add(prodSelection);
            }
        }
        else
        {
            label.text = "-";
        }

        #region SelectionList

        GetProductNamesAndTypes(out List <Type> types, out List <string> names);
        ListView typeSelectionList = body.Q <ListView>("TypesList");

        Button allButton = new Button {
            text = "Select All"
        };
        allButton.style.width = 70;
        allButton.clicked    += () => OnAllCategorySelected(selectedProductCategories, names);

        FillListWithToggle(names, "Product", selectedProductCategories, typeSelectionList, OnProductTypeSelected);
        typeSelectionList.contentContainer.Insert(0, allButton);
        typeSelectionList.Insert(0, allButton);

        #endregion

        #region Preview
        if (_selectedPreviewProduct != null)
        {
            VisualElement selectionRender = body.Q <VisualElement>("Right");

            selectionRender.style.paddingLeft   = 5;
            selectionRender.style.paddingRight  = 5;
            selectionRender.style.paddingTop    = 5;
            selectionRender.style.paddingBottom = 5;

            Button closeButton = new Button()
            {
                text = "X"
            };
            closeButton.clicked += () =>
            {
                _selectedPreviewProduct = null;
                Render();
            };
            closeButton.style.width  = 20;
            closeButton.style.height = 20;

            scriptableObjectEdit_View.CloneTree(selectionRender);
            Image          icon     = new Image();
            IMGUIContainer soRender = selectionRender.Q <IMGUIContainer>("Render");
            icon.style.alignSelf       = new StyleEnum <Align>(Align.Center);
            icon.style.height          = 100;
            icon.style.width           = 100;
            icon.style.backgroundColor = new Color(.25f, .25f, .25f);
            icon.style.marginTop       = 10;
            icon.style.marginBottom    = 10;

            selectionRender.Insert(0, icon);
            selectionRender.Insert(0, closeButton);

            if (_selectedPreviewProduct != null)
            {
                Editor editor = Editor.CreateEditor(_selectedPreviewProduct);
                soRender.onGUIHandler = () => editor.OnInspectorGUI();
                if (_selectedPreviewProduct.Icon != null)
                {
                    icon.image = _selectedPreviewProduct.Icon.texture;
                }
            }

            VisualElement buttons = body.Q <VisualElement>("Buttons");
            if (buttons != null)
            {
                buttons.style.opacity = 0;
                buttons.SetEnabled(false);
            }
            soRender.SetEnabled(false);
        }
        #endregion

        #region Add Selection
        VisualElement lowerContent = body.Q <VisualElement>("LowerContent");
        lowerContent.contentContainer.style.flexDirection = new StyleEnum <FlexDirection>(FlexDirection.Row);
        lowerContent.contentContainer.style.flexWrap      = new StyleEnum <Wrap>(Wrap.Wrap);

        HashSet <BaseProduct> products = new HashSet <BaseProduct>();
        Dictionary <string, List <BaseProduct> > productsByClass = MarketManager.GetProductsByClass();

        if (_selectedCatalog == null)
        {
            return;
        }

        foreach (KeyValuePair <string, List <BaseProduct> > keyValuePair in productsByClass)
        {
            if (!selectedProductCategories.Contains(keyValuePair.Key))
            {
                continue;
            }
            for (int i = 0; i < keyValuePair.Value.Count; i++)
            {
                if (!_selectedCatalog.Products.Contains(keyValuePair.Value[i]))
                {
                    products.Add(keyValuePair.Value[i]);
                }
            }
        }

        foreach (BaseProduct itemProduct in products)
        {
            lowerContent.Add(
                CreateProductSelectionButton(
                    itemProduct,
                    baseProduct => AddTo(itemProduct, _selectedCatalog),
                    new []
            {
                new Tuple <string, Action>("Preview", () => PreviewProduct(itemProduct)),
                new Tuple <string, Action>("Edit", () => GoToProductEdit(itemProduct)),
                new Tuple <string, Action>("Delete", () => DestroyProduct(itemProduct))
            }));
        }

        #endregion
    }
Exemple #26
0
        public static ListView <CUseable> GetUseableListFromReward(COMDT_REWARD_DETAIL reward)
        {
            ListView <CUseable> listView = new ListView <CUseable>();

            for (int i = 0; i < (int)reward.bNum; i++)
            {
                switch (reward.astRewardDetail[i].bType)
                {
                case 0:
                {
                    CUseable item = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwCoin, 0u);
                    listView.Add(item);
                    break;
                }

                case 1:
                {
                    CUseable cUseable = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stItem.dwCnt, reward.astRewardDetail[i].stRewardInfo.stItem.dwItemID);
                    if (cUseable != null)
                    {
                        if (reward.astRewardDetail[i].bFromType == 1)
                        {
                            cUseable.ExtraFromType = (int)reward.astRewardDetail[i].bFromType;
                            cUseable.ExtraFromData = (int)reward.astRewardDetail[i].stFromInfo.stHeroInfo.dwHeroID;
                        }
                        else if (reward.astRewardDetail[i].bFromType == 2)
                        {
                            cUseable.ExtraFromType = (int)reward.astRewardDetail[i].bFromType;
                            cUseable.ExtraFromData = (int)reward.astRewardDetail[i].stFromInfo.stSkinInfo.dwSkinID;
                        }
                        listView.Add(cUseable);
                    }
                    break;
                }

                case 3:
                {
                    CUseable item2 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwCoupons, 0u);
                    listView.Add(item2);
                    break;
                }

                case 4:
                {
                    CUseable item3 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stEquip.dwCnt, reward.astRewardDetail[i].stRewardInfo.stEquip.dwEquipID);
                    listView.Add(item3);
                    break;
                }

                case 5:
                {
                    CUseable item4 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stHero.dwCnt, reward.astRewardDetail[i].stRewardInfo.stHero.dwHeroID);
                    listView.Add(item4);
                    break;
                }

                case 6:
                {
                    CUseable item5 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stSymbol.dwCnt, reward.astRewardDetail[i].stRewardInfo.stSymbol.dwSymbolID);
                    listView.Add(item5);
                    break;
                }

                case 7:
                {
                    CUseable item6 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwBurningCoin, 0u);
                    listView.Add(item6);
                    break;
                }

                case 8:
                {
                    CUseable item7 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwArenaCoin, 0u);
                    listView.Add(item7);
                    break;
                }

                case 9:
                {
                    CUseable item8 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwAP, 0u);
                    listView.Add(item8);
                    break;
                }

                case 10:
                {
                    CUseable item9 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.stSkin.dwCnt, reward.astRewardDetail[i].stRewardInfo.stSkin.dwSkinID);
                    listView.Add(item9);
                    break;
                }

                case 11:
                {
                    CUseable item10 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwPvpCoin, 0u);
                    listView.Add(item10);
                    break;
                }

                case 12:
                {
                    CUseable item11 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwHeroPoolExp, 0u);
                    listView.Add(item11);
                    break;
                }

                case 13:
                {
                    CUseable item12 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwSkinCoin, 0u);
                    listView.Add(item12);
                    break;
                }

                case 14:
                {
                    CUseable cUseable2 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwSymbolCoin, 0u);
                    if (cUseable2 != null)
                    {
                        listView.Add(cUseable2);
                    }
                    break;
                }

                case 16:
                {
                    CUseable item13 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwDiamond, 0u);
                    listView.Add(item13);
                    break;
                }

                case 17:
                {
                    CUseable cUseable3 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwHuoYueDu, 0u);
                    if (cUseable3 != null)
                    {
                        listView.Add(cUseable3);
                    }
                    break;
                }

                case 18:
                {
                    CUseable item14 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMatchPointPer, 0u);
                    listView.Add(item14);
                    break;
                }

                case 19:
                {
                    CUseable item15 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMatchPointGuild, 0u);
                    listView.Add(item15);
                    break;
                }

                case 20:
                {
                    CUseable cUseable4 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, 1, reward.astRewardDetail[i].stRewardInfo.stHeadImage.dwHeadImgID);
                    if (cUseable4 != null)
                    {
                        listView.Add(cUseable4);
                    }
                    break;
                }

                case 21:
                {
                    CUseable cUseable5 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwAchieve, 0u);
                    if (cUseable5 != null)
                    {
                        listView.Add(cUseable5);
                    }
                    break;
                }

                case 22:
                {
                    CUseable cUseable6 = CUseableManager.CreateUsableByServerType((COM_REWARDS_TYPE)reward.astRewardDetail[i].bType, (int)reward.astRewardDetail[i].stRewardInfo.dwMasterPoint, 0u);
                    if (cUseable6 != null)
                    {
                        listView.Add(cUseable6);
                    }
                    break;
                }
                }
            }
            return(listView);
        }
Exemple #27
0
        public static void OnRankGodDetailTab(int tabIndex, COMDT_RANKING_LIST_ITEM_EXTRA_MASTER_HERO masterHeroInfo, uint heroId)
        {
            CUIFormScript form = Singleton <CUIManager> .instance.GetForm(RankingSystem.s_rankingGodDetailForm);

            if (form != null)
            {
                GameObject widget = form.GetWidget(0);
                if (widget != null)
                {
                    ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);
                    if (dataByKey != null)
                    {
                        GameObject obj3   = Utility.FindChild(widget, "Panel_EquipInfo");
                        GameObject obj4   = Utility.FindChild(widget, "Panel_SymbolInfo");
                        string     str    = Utility.UTF8Convert(masterHeroInfo.stAcntInfo.szPlayerName);
                        string     szName = dataByKey.szName;
                        obj3.CustomSetActive(false);
                        obj4.CustomSetActive(false);
                        if (tabIndex == 0)
                        {
                            obj3.CustomSetActive(true);
                            CUIListScript componetInChild           = Utility.GetComponetInChild <CUIListScript>(obj3, "List");
                            int           bEquipNum                 = masterHeroInfo.stEquipList.bEquipNum;
                            ushort[]      defaultRecommendEquipInfo = new ushort[6];
                            if (bEquipNum > 0)
                            {
                                for (int j = 0; j < bEquipNum; j++)
                                {
                                    defaultRecommendEquipInfo[j] = (ushort)masterHeroInfo.stEquipList.EquipID[j];
                                }
                            }
                            else
                            {
                                defaultRecommendEquipInfo = Singleton <CEquipSystem> .instance.GetDefaultRecommendEquipInfo(heroId);

                                bEquipNum = defaultRecommendEquipInfo.Length;
                            }
                            componetInChild.SetElementAmount(bEquipNum);
                            for (int i = 0; i < bEquipNum; i++)
                            {
                                GameObject     gameObject = componetInChild.GetElemenet(i).gameObject;
                                CUIEventScript component  = gameObject.GetComponent <CUIEventScript>();
                                ushort         equipID    = defaultRecommendEquipInfo[i];
                                CEquipInfo     equipInfo  = Singleton <CEquipSystem> .instance.GetEquipInfo(equipID);

                                component.m_onClickEventParams.battleEquipPar.equipInfo = Singleton <CEquipSystem> .instance.GetEquipInfo(equipID);

                                component.m_onClickEventParams.tagStr  = str;
                                component.m_onClickEventParams.tagStr1 = szName;
                                CUICommonSystem.SetEquipIcon(equipID, gameObject, form);
                            }
                            if (bEquipNum > 0)
                            {
                                componetInChild.SelectElement(0, true);
                                componetInChild.GetElemenet(0).GetComponent <CUIEventScript>().OnPointerClick(null);
                                CUIEventScript script4 = componetInChild.GetElemenet(0).GetComponent <CUIEventScript>();
                                Singleton <CUIEventManager> .instance.DispatchUIEvent(script4.m_onClickEventID, script4.m_onClickEventParams);
                            }
                            else
                            {
                                componetInChild.SelectElement(-1, true);
                            }
                        }
                        else if (tabIndex == 1)
                        {
                            ListView <CSymbolItem> symbolList = new ListView <CSymbolItem>();
                            for (int k = 0; k < masterHeroInfo.stSymbolPageInfo.bSymbolPosNum; k++)
                            {
                                bool flag = false;
                                for (int n = 0; n < symbolList.Count; n++)
                                {
                                    if (symbolList[n].m_baseID == masterHeroInfo.stSymbolPageInfo.SymbolId[k])
                                    {
                                        CSymbolItem local1 = symbolList[n];
                                        local1.m_stackCount++;
                                        flag = true;
                                        break;
                                    }
                                }
                                if (!flag)
                                {
                                    CSymbolItem item = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMSYMBOL, masterHeroInfo.stSymbolPageInfo.SymbolId[k], 1) as CSymbolItem;
                                    symbolList.Add(item);
                                }
                            }
                            CSymbolWearController.SortSymbolList(ref symbolList);
                            obj4.CustomSetActive(true);
                            CUIListScript script5 = Utility.GetComponetInChild <CUIListScript>(obj4, "List");
                            script5.SetElementAmount(symbolList.Count);
                            int num7 = 0;
                            for (int m = 0; m < symbolList.Count; m++)
                            {
                                GameObject p = script5.GetElemenet(m).gameObject;
                                Utility.GetComponetInChild <Image>(p, "imgIcon").SetSprite(symbolList[m].GetIconPath(), form, true, false, false);
                                Utility.GetComponetInChild <Text>(p, "SymbolName").text = symbolList[m].m_name;
                                char[] trimChars = new char[] { '\n' };
                                Utility.GetComponetInChild <Text>(p, "SymbolDesc").text   = CSymbolSystem.GetSymbolAttString(symbolList[m], true).TrimEnd(trimChars);
                                Utility.GetComponetInChild <Text>(p, "lblIconCount").text = string.Format("x{0}", symbolList[m].m_stackCount);
                                num7 += symbolList[m].m_SymbolData.wLevel;
                            }
                            Utility.GetComponetInChild <Text>(obj4, "symbolPageLvlText").text = num7.ToString();
                            string[] args = new string[] { str, szName };
                            Utility.GetComponetInChild <Text>(obj4, "heroSymbolText").text = Singleton <CTextManager> .instance.GetText("RankGodHeroSymbolDesc", args);
                        }
                    }
                }
            }
        }
Exemple #28
0
        public BuyPickDialog(bool isGift, COM_ITEM_TYPE type, uint id, RES_SHOPBUY_COINTYPE coinType, float discount, uint maxCount, OnConfirmBuyDelegate onConfirm, CMallFactoryShopController.ShopProduct callContext, OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CUIFormScript formScript = Singleton <CUIManager> .GetInstance().OpenForm(s_Gift_Form_Path, false, true);

            if (null != formScript)
            {
                this._root                 = formScript.gameObject;
                this._usb                  = CUseableManager.CreateUseable(type, id, 0);
                this._count                = 1;
                this._bHeroSkinGift        = false;
                this._bDynamicCorrectPrice = false;
                this._heroSkinGiftCost     = 0;
                this._maxCount             = maxCount;
                if (this._maxCount == 0)
                {
                    this._maxCount = 0x3e7;
                }
                this._onConfirm        = onConfirm;
                this._callContext      = callContext;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    this._descText  = Utility.GetComponetInChild <Text>(this._root, "Panel/lblDesc");
                    CItem item = new CItem(0L, id, 0, 0);
                    uint  key  = (uint)item.m_itemData.EftParam[0];
                    ResRandomRewardStore dataByKey = GameDataMgr.randomRewardDB.GetDataByKey(key);
                    ListView <CUseable>  view      = new ListView <CUseable>();
                    for (int i = 0; i < dataByKey.astRewardDetail.Length; i++)
                    {
                        if (dataByKey.astRewardDetail[i].bItemType != 0)
                        {
                            CUseable useable = CUseableManager.CreateUsableByRandowReward((RES_RANDOM_REWARD_TYPE)dataByKey.astRewardDetail[i].bItemType, (int)dataByKey.astRewardDetail[i].dwLowCnt, dataByKey.astRewardDetail[i].dwItemID);
                            if (useable != null)
                            {
                                view.Add(useable);
                            }
                        }
                    }
                    if (this._descText != null)
                    {
                        this._descText.text = item.m_description;
                    }
                    uint num3 = 0;
                    int  num4 = 0;
                    if (this._usb.m_type == COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP)
                    {
                        CItem item2 = (CItem)this._usb;
                        if (((item2 != null) && (item2.m_itemData != null)) && (item2.m_itemData.bType == 4))
                        {
                            this._bDynamicCorrectPrice = item2.m_itemData.EftParam[3] > 0f;
                        }
                    }
                    for (int j = 0; j < 10; j++)
                    {
                        GameObject gameObject = this._root.transform.Find("Panel/itemGroup/itemCell" + j).gameObject;
                        if (j < view.Count)
                        {
                            gameObject.CustomSetActive(true);
                            CUICommonSystem.SetItemCell(formScript, gameObject, view[j], true, false);
                            Transform transform = gameObject.transform.Find("HaveItemFlag");
                            transform.gameObject.CustomSetActive(false);
                            if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HERO)
                            {
                                this._bHeroSkinGift = true;
                                CHeroItem item3          = view[j] as CHeroItem;
                                CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((masterRoleInfo != null) && masterRoleInfo.IsOwnHero(item3.m_heroData.dwCfgID))
                                {
                                    num3 += CHeroInfo.GetHeroCost(item3.m_heroData.dwCfgID, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                            else if (view[j].m_type == COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN)
                            {
                                this._bHeroSkinGift = true;
                                CHeroSkin skin  = view[j] as CHeroSkin;
                                CRoleInfo info2 = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

                                if ((info2 != null) && info2.IsHaveHeroSkin(skin.m_heroId, skin.m_skinId, false))
                                {
                                    num3 += CSkinInfo.GetHeroSkinCost(skin.m_heroId, skin.m_skinId, coinType);
                                    num4++;
                                    transform.gameObject.CustomSetActive(true);
                                }
                            }
                        }
                        else
                        {
                            gameObject.CustomSetActive(false);
                        }
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false));
                    }
                    Text componetInChild = Utility.GetComponetInChild <Text>(this._root, "Panel/costDescText");
                    componetInChild.text = string.Empty;
                    if (this._bHeroSkinGift && this._bDynamicCorrectPrice)
                    {
                        uint   buyPrice = this._usb.GetBuyPrice(coinType);
                        Button btn      = Utility.GetComponetInChild <Button>(this._root, "Panel/Button_Sale");
                        if (num4 >= view.Count)
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, false, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Can_Not_Buy_Tip");

                            this._heroSkinGiftCost = 0;
                        }
                        else
                        {
                            CUICommonSystem.SetButtonEnableWithShader(btn, true, true);
                            componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("Gift_Own_Hero_Skin_Tip");

                            uint num7 = CMallFactoryShopController.ShopProduct.SConvertWithRealDiscount(buyPrice - num3, this._realDiscount);
                            if ((buyPrice >= num3) && (num7 >= (buyPrice / 10)))
                            {
                                this._heroSkinGiftCost = num7;
                            }
                            else
                            {
                                this._heroSkinGiftCost = buyPrice / 10;
                            }
                        }
                        if (this._callContext != null)
                        {
                            this._callContext.m_bChangeGiftPrice = true;
                            this._callContext.m_newGiftPrice     = this._heroSkinGiftCost;
                        }
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                this.ValidateDynamic();
            }
        }
Exemple #29
0
    private bool RefreshData()
    {
        this.m_HotSaleListView.Clear();
        this.m_NewArrivalListView.Clear();
        DictionaryView <uint, ResBoutiqueConf> .Enumerator enumerator = GameDataMgr.boutiqueDict.GetEnumerator();
        int currentUTCTime = CRoleInfo.GetCurrentUTCTime();

        while (enumerator.MoveNext())
        {
            KeyValuePair <uint, ResBoutiqueConf> current = enumerator.get_Current();
            ResBoutiqueConf value = current.get_Value();
            if ((ulong)value.dwOnTimeGen <= (ulong)((long)currentUTCTime) && (ulong)value.dwOffTimeGen >= (ulong)((long)currentUTCTime))
            {
                RES_BOUTIQUE_TYPE          bBoutiqueType     = value.bBoutiqueType;
                ListView <ResBoutiqueConf> listView          = null;
                RES_BOUTIQUE_TYPE          rES_BOUTIQUE_TYPE = bBoutiqueType;
                if (rES_BOUTIQUE_TYPE != 1)
                {
                    if (rES_BOUTIQUE_TYPE == 2)
                    {
                        listView = this.m_HotSaleListView;
                    }
                }
                else
                {
                    listView = this.m_NewArrivalListView;
                }
                switch (value.wItemType)
                {
                case 2:
                case 5:
                {
                    CMallFactoryShopController.ShopProduct product = Singleton <CMallFactoryShopController> .GetInstance().GetProduct(value.dwItemID);

                    if (product != null && product.IsOnSale == 1 && listView != null)
                    {
                        listView.Add(value);
                    }
                    break;
                }

                case 4:
                {
                    ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(value.dwItemID);
                    if (dataByKey != null)
                    {
                        if (GameDataMgr.IsHeroAvailable(dataByKey.dwCfgID) && listView != null)
                        {
                            listView.Add(value);
                        }
                    }
                    break;
                }

                case 7:
                {
                    ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(value.dwItemID);
                    if (heroSkin != null)
                    {
                        ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID);
                        if (dataByKey2 != null)
                        {
                            if (GameDataMgr.IsSkinAvailable(heroSkin.dwID) && GameDataMgr.IsHeroAvailable(dataByKey2.dwCfgID) && listView != null)
                            {
                                listView.Add(value);
                            }
                        }
                    }
                    break;
                }
                }
            }
        }
        return(true);
    }