Exemple #1
0
    static public bool GetPersonModel(UInt16 wHeroID, ref PersonSkinModelItem data)
    {
        IntPtr ptr = getPersonModel(wHeroID);

        if ((int)ptr == 0)
        {
            return(false);
        }

        data = IntPtrHelper.toData <PersonSkinModelItem>(ptr);
        return(true);
    }
Exemple #2
0
        private void SetAllGoodsTileDataSource(ObservableList <UWarGoodsStoreItem> _datSource)
        {
            AllGoodsTile.SelectedIndex  = -1;
            AllGoodsTile2.SelectedIndex = -1;

            AllGoodsTile.OnDeselect.RemoveListener(OnAllGoodsOnDeselect);
            AllGoodsTile2.OnDeselect.RemoveListener(OnAllGoodsOnDeselect);

            AllGoodsTile.OnSelect.RemoveListener(OnMobaGoodsSelected);
            AllGoodsTile.onDoubleClick.RemoveListener(OnMobaGoodsBuy);
            AllGoodsTile.onRightClick.RemoveListener(OnMobaGoodsBuy);

            AllGoodsTile2.OnSelect.RemoveListener(OnMobaGoodsSelected2);
            AllGoodsTile2.onDoubleClick.RemoveListener(OnMobaGoodsBuy2);
            AllGoodsTile2.onRightClick.RemoveListener(OnMobaGoodsBuy2);

            if (!U3D_Render.EntityView.isNullOrEmpty(EntityFactory.MainHeroView) && EntityFactory.MainHeroView.Property != null)
            {
                int nHeroId = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
                PersonSkinModelItem ModelItem = new PersonSkinModelItem();
                GameLogicAPI.GetPersonModel((UInt16)nHeroId, ref ModelItem);

                //移除英雄限制的装备
                var list = _datSource.Select(d => d).Where(s => (s.SchemeGoodsInfo.GoodsVocationLimit != 0 && s.SchemeGoodsInfo.GoodsVocationLimit == ModelItem.nTraits)).ToList();
                foreach (var i in list)
                {
                    _datSource.Remove(i);
                }
            }

            //根据物品的贵重度分放到不同的Title

            var dataSource0 = _datSource.Select(d => d).Where(s => (s.SchemeGoodsInfo.GoodsPreciousDegree == 0)).ToObservableList();
            var dataSource1 = _datSource.Select(d => d).Where(s => (s.SchemeGoodsInfo.GoodsPreciousDegree == 1)).ToObservableList();


            AllGoodsTile.DataSource  = dataSource0;
            AllGoodsTile2.DataSource = dataSource1;


            AllGoodsTile.OnDeselect.AddListener(OnAllGoodsOnDeselect);
            AllGoodsTile2.OnDeselect.AddListener(OnAllGoodsOnDeselect);


            AllGoodsTile.OnSelect.AddListener(OnMobaGoodsSelected);
            AllGoodsTile.onDoubleClick.AddListener(OnMobaGoodsBuy);
            AllGoodsTile.onRightClick.AddListener(OnMobaGoodsBuy);

            AllGoodsTile2.OnSelect.AddListener(OnMobaGoodsSelected2);
            AllGoodsTile2.onDoubleClick.AddListener(OnMobaGoodsBuy2);
            AllGoodsTile2.onRightClick.AddListener(OnMobaGoodsBuy2);
        }
        private string GetParamText(int nGoodType, int nParam)
        {
            string szParam = "";

            if (nGoodType == (int)TimeThresholdGoodsType.TIMETHRESHOLDGOODSTYPE_SKIN)
            {
                PersonSkinModelItem modelData = new PersonSkinModelItem();
                if (GameLogicAPI.GetPersonModel((UInt16)nParam, ref modelData))
                {
                    szParam = "英雄 : " + modelData.szHeroName;
                }
            }

            return(szParam);
        }
Exemple #4
0
        protected override bool CustomPrecondition(TBTWorkingData wData)
        {
            bool result = false;

            if (EntityFactory.MainHeroView != null && EntityFactory.MainHeroView.Property != null)
            {
                int nHeroId = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
                PersonSkinModelItem modelData = new PersonSkinModelItem();
                GameLogicAPI.GetPersonModel((UInt16)nHeroId, ref modelData);
                result = modelData.nPlayMode == m_nCheckPlayMode;
            }
            TLogger.PROFILE("判断主角英雄是否需要" + (PlayMode)m_nCheckPlayMode + " 模式操作::" + result);

            return(result);
        }
Exemple #5
0
    public void InitDropMachineInfo()
    {
        int nDropIdex = 0;

        string strHeroName            = "";
        PersonSkinModelItem modelData = new PersonSkinModelItem();

        for (int i = (int)VOCATION.VOCATION_RANDOM; i < (int)VOCATION.VOCATION_MAX; i++)
        {
            // 查找英雄AI配置
            SSchemeHeroAIConfig SchmeInfo = null;
            HeroAIConfig.Instance.GetHeroAIInfo(nConfigWarID, i, ref SchmeInfo);
            if (SchmeInfo == null)
            {
                continue;
            }
            if (SchmeInfo.bIsOpen == false)
            {
                continue;
            }

            MachineInfo machineInfo = new MachineInfo();
            machineInfo.nIconId = i;// 是图片id
            machineInfo.bLock   = false;

            strHeroName = "";
            if (i >= 0 && GameLogicAPI.GetPersonModel((UInt16)i, ref modelData))
            {
                strHeroName = modelData.szHeroName;
            }
            machineInfo.stDesc        = strHeroName;
            dicDropHeroIdWithIndex[i] = nDropIdex;// 储存英雄图片id对应的槽位
            dDropMachineInfo.Add(machineInfo);
            nDropIdex++;
        }
        // 给每个槽位发送基本的数据

        // 给as发送假人的名字和图片id,假人名字这些数据还没接受
        for (int i = 0; i < 10; i++)
        {
            int nSlotId   = i > 4 ? i - 5 : i;
            int nSlotCamp = i > 4 ? 1 : 0;
            SetMachineInfo(nSlotCamp, nSlotId);
        }
    }
Exemple #6
0
        /// <summary>
        /// 点击英雄头像
        /// </summary>
        /// <param name="nHeroID"></param>
        public void onClickHeroHeadPortrait(int nHeroID)
        {
            SSchemeHeroTypeConfig config    = HeroTypeConfig.Instance.GetHeroTypeConfig(nHeroID);
            PersonSkinModelItem   ModelItem = new PersonSkinModelItem();

            if (config == null || !GameLogicAPI.GetPersonModel((ushort)nHeroID, ref ModelItem) || TxtHeroName == null || TxtHeroDes == null)
            {
                return;
            }

            TopLeftGameObj.SetActive(true);

            TxtHeroName.text = ModelItem.szHeroName;
            TxtHeroDes.text  = config.strHeroDesc;
            DataCenter.CreateHeroDataManager.Instance.PlayerCreateHeroID = nHeroID;

            SetChangeHeroSkin(ModelItem.nDefaultSkinID, nHeroID);
        }
Exemple #7
0
        private void setHeroSkinModel(SSetSKinModelInfo[] heroInfoList)
        {
            if (SelectTransForm == null)
            {
                return;
            }

            int nCount = heroInfoList.Length;

            m_LastSkinID     = new int[heroInfoList.Length];
            m_LastSkinObject = new SkinInstance[heroInfoList.Length];

            int nListIndex = 0;

            foreach (var item in heroInfoList)
            {
                PersonSkinModelItem modelData = new PersonSkinModelItem();
                if (GameLogicAPI.GetPersonModel((UInt16)item.nHeroID, ref modelData))
                {
                    int nSkinID = item.nSkinID;
                    if (nSkinID <= 0)
                    {
                        Debug.LogWarning("skinID <= 0, nHeroID=" + item.nHeroID);

                        nSkinID = modelData.nDefaultSkinID;
                    }

                    SkinManager.SetChangeHeroSkin(nSkinID, item.nHeroID, ref m_LastSkinObject[nListIndex], ref m_LastSkinID[nListIndex], SelectTransForm, HEROSKIN_RENDER_TYPE.SCENE, PERSONMODELVIEWID.PERSONMODELVIEWID_WARSUPPORT);
                    if (m_LastSkinObject[nListIndex] != null && m_LastSkinObject[nListIndex].isValid)
                    {
                        SetSkinItemModelPosition(m_LastSkinObject[nListIndex].SkinObj, item.nSortID, nCount);
                    }
                }

                nListIndex++;
            }
        }
Exemple #8
0
        public void BoxRecommendedGoodsByGoodsType(System.Collections.Generic.List <SSchemeMobaGoods> _typeList, List <int> _dispositionTypeList, EMobaRecommendGoods _eRecommendType)
        {
            m_nUsedRecommendType++;
            //取显示对象挂载容器
            Transform containner = GetCurrentContainer();
            ResNode   go         = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, "UI/Prefabs/" + UPath.UDynamicMobaState + "/WarGoodsStore/WarGoodsStoreRecommendComponent");
            UWarGoodsStoreRecommendComponent component;

            //取该类型标题本地化文本
            if (GetCurrentContainerTitleText() != null)
            {
                ULocalizationService.Instance.Get(GetCurrentContainerTitleText(), "UIView", "WarGoodsStore", _eRecommendType.ToString());
            }
            //移除英雄限制的装备
            int nHeroId = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
            PersonSkinModelItem ModelItem = new PersonSkinModelItem();

            GameLogicAPI.GetPersonModel((UInt16)nHeroId, ref ModelItem);

            var list = _typeList.Select(d => d).Where(s => (s.GoodsVocationLimit != 0 && s.GoodsVocationLimit == ModelItem.nTraits)).ToList();

            foreach (var i in list)
            {
                _typeList.Remove(i);
            }

            int count = _typeList.Count >= 6 ? 6 : _typeList.Count;

            for (int i = 0; i < count; ++i) //each (var schemeGoods in _typeList)
            {
                SSchemeMobaGoods   schemeGoods = _typeList[i];
                UWarGoodsStoreItem newItem     = LogicDataCenter.warMobaGoodsDataManager.GetWarGoodsStoreItem(schemeGoods);//m_MyParent.GetWarGoodsStoreItem(schemeGoods);
                if (newItem != null)
                {
                    m_ReCommendGoodsItemList.Add(newItem);

                    component = go.InstanceMainRes <UWarGoodsStoreRecommendComponent>();
                    component.gameObject.name = newItem.SchemeGoodsInfo.GoodsName;
                    component.SetData(newItem);

                    component.Group = m_RecommendGoodsGroup;
                    component.transform.SetParent(containner, false);

                    component.onSelectedChangedEx.AddListener(OnMobaGoodsSelected);
                    component.onDoubleClick.AddListener(OnMobaGoodsBuy);
                    component.onRightClick.AddListener(OnMobaGoodsBuy);
                }
                else
                {
                    newItem = new UWarGoodsStoreItem(schemeGoods);

                    if (LogicDataCenter.warMobaGoodsDataManager.EnableGoodsFilter && newItem.IsFiltered)
                    {
                        continue;
                    }

                    newItem.GoodsComponentVisible = false;
                    m_ReCommendGoodsItemList.Add(newItem);
                    component       = go.InstanceMainRes <UWarGoodsStoreRecommendComponent>();
                    component.Group = m_RecommendGoodsGroup;
                    component.transform.SetParent(containner, false);

                    component.onSelectedChangedEx.AddListener(OnMobaGoodsSelected);
                    component.onDoubleClick.AddListener(OnMobaGoodsBuy);
                    component.onRightClick.AddListener(OnMobaGoodsBuy);

                    component.SetData(newItem);
                }
                //存下更改物品配置时需要替换的推荐类型
                if (_dispositionTypeList != null && _dispositionTypeList.Contains((int)_eRecommendType))
                {
                    LogicDataCenter.warMobaGoodsDataManager.SetHeroDefaultGoods(i, schemeGoods.GoodsID, m_nUsedRecommendType);
                }
            }
        }
Exemple #9
0
        // 显示英雄头像星级及卡牌数量
        public void ShowHeroHead(Dictionary <int, cmd_entity_hero_info> dicEntityHeroInfo, Dictionary <int, cmd_entity_nohanve_hero> dicEntityNoHaveHeroInfo, int nCurrentGold = 0)
        {
            HeroList.DataSource.Clear();
            UIWidgets.ObservableList <UTileViewItemHero> dataSource = new UIWidgets.ObservableList <UTileViewItemHero>();

            // 遍历已拥有的英雄加到表中
            foreach (KeyValuePair <int, cmd_entity_hero_info> kvp in dicEntityHeroInfo)
            {
                cmd_entity_hero_info cmdInfo = kvp.Value;
                int nHeroID = cmdInfo.nHeroID;

                SHeroStarSchemeInfo pStarScheme = new SHeroStarSchemeInfo();
                if (!GameLogicAPI.getHeroStarConfig(nHeroID, cmdInfo.byStarLv, ref pStarScheme))
                {
                    continue;
                }
                bool bIsLifeHero = LogicDataCenter.lifeHeroDataManager.AllLifeHero.ContainsKey(nHeroID);
                int  nNeedCard   = bIsLifeHero && pStarScheme.nCardDiscount > 0 ? pStarScheme.nCardDiscount : pStarScheme.nNeedCount;
                int  nNeedGold   = bIsLifeHero && pStarScheme.nGoldDiscount > 0 ? pStarScheme.nGoldDiscount : pStarScheme.nExpendGold;
                if (nNeedCard <= 0 || nNeedGold <= 0)
                {
                    continue;
                }

                PersonSkinModelItem modelData = new PersonSkinModelItem();
                if (!GameLogicAPI.GetPersonModel((UInt16)nHeroID, ref modelData))
                {
                    continue;
                }

                UTileViewItemHero item = new UTileViewItemHero();
                item.nHeroID  = nHeroID;
                item.headIcon = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_PLAYERFRAME, 1, 9, nHeroID);
                if (item.headIcon == null)
                {
                    item.headIcon = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_PLAYERFRAME, 1, 9, 10);
                }
                item.stName    = cmdInfo.chHeroName;
                item.stTitle   = modelData.szHeroTitle;
                item.nStarLv   = cmdInfo.byStarLv;
                item.bHaveHero = (cmdInfo.bIsBuy > 0);
                item.bWeekFree = (cmdInfo.bIsWeekFree > 0);

                item.nStarLvLimit = pStarScheme.nLimitLV;
                item.fExpValue    = (float)cmdInfo.nCardCount / nNeedCard;
                item.stStarExp    = cmdInfo.nCardCount.ToString() + (cmdInfo.byStarLv >= pStarScheme.nLimitLV ? "" : "/" + nNeedCard.ToString());
                int nGold = nCurrentGold == 0 ? EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_GOLD) : nCurrentGold;

                // 已购买、未满级、卡够、钱够
                item.bUpGrade = (cmdInfo.bIsBuy > 0 && cmdInfo.byStarLv < pStarScheme.nLimitLV && item.fExpValue >= 1 && nGold >= nNeedGold);

                item.nUnlockLevel = modelData.nUnlockLevel;
                item.bFpsHero     = modelData.nPlayMode > 0;

                dataSource.Add(item);
            }

            // 遍历未拥有的英雄遍历到表中
            foreach (KeyValuePair <int, cmd_entity_nohanve_hero> kvp in dicEntityNoHaveHeroInfo)
            {
                cmd_entity_nohanve_hero cmdInfo = kvp.Value;
                int nHeroID = cmdInfo.nHeroID;

                PersonSkinModelItem modelData = new PersonSkinModelItem();
                if (!GameLogicAPI.GetPersonModel((UInt16)nHeroID, ref modelData))
                {
                    continue;
                }

                SHeroStarSchemeInfo pStarScheme = new SHeroStarSchemeInfo();
                if (!GameLogicAPI.getHeroStarConfig(nHeroID, 1, ref pStarScheme))
                {
                    continue;
                }

                bool bIsLifeHero = LogicDataCenter.lifeHeroDataManager.AllLifeHero.ContainsKey(nHeroID);
                int  nNeedCard   = bIsLifeHero && pStarScheme.nCardDiscount > 0 ? pStarScheme.nCardDiscount : pStarScheme.nNeedCount;
                int  nNeedGold   = bIsLifeHero && pStarScheme.nGoldDiscount > 0 ? pStarScheme.nGoldDiscount : pStarScheme.nExpendGold;
                if (nNeedCard <= 0 || nNeedGold <= 0)
                {
                    continue;
                }

                UTileViewItemHero item = new UTileViewItemHero();
                item.nHeroID  = nHeroID;
                item.headIcon = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_PLAYERFRAME, 1, 9, nHeroID);
                if (item.headIcon == null)
                {
                    item.headIcon = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_HeadPortrait, WndID.WND_ID_PLAYERFRAME, 1, 9, 10);
                }
                item.stName    = cmdInfo.chHeroName;
                item.stTitle   = modelData.szHeroTitle;
                item.nStarLv   = 1;
                item.bHaveHero = false;
                item.bWeekFree = false;

                item.nStarLvLimit = pStarScheme.nLimitLV;
                item.fExpValue    = (float)cmdInfo.nHaveCardCount / nNeedCard;
                item.stStarExp    = cmdInfo.nHaveCardCount.ToString() + "/" + nNeedCard.ToString();
                item.bUpGrade     = false;

                item.nUnlockLevel = modelData.nUnlockLevel;
                item.bFpsHero     = modelData.nPlayMode > 0;

                dataSource.Add(item);
            }
            dataSource.Sort(CompareMemberList);
            HeroList.DataSource = dataSource;

            //增加监听点击头像的事件
            HeroList.OnSelect.RemoveAllListeners();
            HeroList.OnSelect.AddListener(ItemSelected);
        }
Exemple #10
0
        public void BoxGoodsLabelDescriptrion(Hashtable _labelDescriptionTable)
        {
            var treeNodes = new ObservableList <TreeNode <UWarGoodsStoreTreeComponentData> >();

            Dictionary <int, List <int> > LabelAndSubLabelDic = new Dictionary <int, List <int> >();

            //根据配置信息建立物品标签二维列表
            foreach (int labelKey in _labelDescriptionTable.Keys)
            {
                if (labelKey == 0)
                {
                    continue;
                }

                int Dickey = labelKey / 1000;

                //大于0深度为1,小于0深度为2
                if (Dickey > 0)
                {
                    if (!LabelAndSubLabelDic.ContainsKey(Dickey))
                    {
                        LabelAndSubLabelDic[Dickey] = new List <int>();
                    }
                    LabelAndSubLabelDic[Dickey].Add(labelKey);
                }
                else
                {
                    if (!LabelAndSubLabelDic.ContainsKey(labelKey))
                    {
                        LabelAndSubLabelDic[labelKey] = new List <int>();
                    }
                }
            }
            //排下序
            foreach (int key in LabelAndSubLabelDic.Keys)
            {
                LabelAndSubLabelDic[key].Sort();
            }
            var LabelAndSubLabelDicOrder = from keyValue in LabelAndSubLabelDic orderby keyValue.Key select keyValue;

            //根据当前英雄特征类型默认展开远程/近战栏,所有类型都要默认展开防御栏
            int nHeroId = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
            PersonSkinModelItem ModelItem = new PersonSkinModelItem();

            GameLogicAPI.GetPersonModel((UInt16)nHeroId, ref ModelItem);
            int index = (ModelItem.nTraits & 4) == 4 ? 2 : (ModelItem.nTraits & 8) == 8 ? 3 : 1;

            //遍历物品标签二维列表
            foreach (var keyValuePair in LabelAndSubLabelDicOrder)
            {
                string Label = Convert.ToString(_labelDescriptionTable[keyValuePair.Key]);
                UBB.toHtml(ref Label);

                //UWarGoodsLabelDesItem item0 = new UWarGoodsLabelDesItem();
                //item0.Depth = 0;
                //item0.GoodsLabel = Label;
                //item0.GoodsLabelID = key;
                //m_LabelDesListDataSource.Add(item0);

                var node0 = Data2TreeNode(Label, 0, keyValuePair.Key);

                // 根据英雄类型默认展开
                // 现在说不要显示防御类型
                //if (keyValuePair.Key == 4 || keyValuePair.Key == index)
                if (keyValuePair.Key == index)
                {
                    node0.IsExpanded = true;
                }

                treeNodes.Add(node0);

                foreach (int subKey in keyValuePair.Value)
                {
                    string SubLabel = Convert.ToString(_labelDescriptionTable[subKey]);
                    //UWarGoodsLabelDesItem item1 = new UWarGoodsLabelDesItem();
                    //UBB.toHtml(ref SubLabel);
                    ////Trace.LogWarning("SubLabel:" + SubLabel);
                    //item1.Depth = 1;
                    //item1.GoodsLabel = SubLabel;
                    //item1.GoodsLabelID = subKey;
                    //m_LabelDesListDataSource.Add(item1);

                    var node1 = Data2TreeNode(SubLabel, 1, subKey);
                    node0.Nodes.Add(node1);
                }
            }

            //GoodsLabelDesList.DataSource = m_LabelDesListDataSource;
            //GoodsLabelDesList.OnSelect.AddListener(OnGoodsLabelSelected);
            if (GoodsLabelDesTree != null)
            {
                GoodsLabelDesTree.Nodes = treeNodes;

                GoodsLabelDesTree.OnSelect.AddListener(OnGoodsLabelSelected);
                GoodsLabelDesTree.OnDeselect.AddListener(OnGoodsLabelDeselected);
                GoodsLabelDesTree.NodeToggle.AddListener(LabelDesNodeToggleEvent);
                GoodsLabelDesTree.NodeCheck.AddListener(OnNodeCheckEvent);
            }
        }