public void OnClickMySelf() { if (id == 2) { if (mTipsText == null) { mTips.SetActive(false); UI_StageInfo._instance.Tips.SetActive(false); } else { mTips.SetActive(true); UI_StageInfo._instance.Tips.SetActive(true); UI_StageInfo._instance.TipsDes.text = GameUtils.getString(mTipsText); } } else { switch (typeNum) { //符文 case 1: ItemTemplate rune = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id); UI_RuneInfo.SetShowRuneDate(rune); UI_HomeControler.Inst.AddUI("UI_Rune/UI_RuneInfo_1_3"); break; //道具 case 2: ItemTemplate item = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(id); UI_Item.SetItemTemplate(item); UI_HomeControler.Inst.AddUI("UI_Home/UI_Item_1_3"); break; //英雄 case 3: UI_HomeControler.Inst.AddUI("UI_Home/UI_HeroInfoPop_1_3"); ObjectCard obj = new ObjectCard(); Hero hero = new Hero(); HeroTemplate _hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(id); hero.skill1 = _hero.getSkill1ID(); hero.skill2 = _hero.getSkill2ID(); hero.skill3 = _hero.getSkill3ID(); hero.heroid = id; hero.herolevel = 1; hero.heroviewid = _hero.getArtresources(); obj.GetHeroData().Init(hero); //Destroy(UI_SelectFightArea.Inst.Card3Dmodel); HeroInfoPop.inst.Show3DModel(obj); HeroInfoPop.inst.ShowInfo(obj); break; default: break; } } }
ObjectCard GetObjectCard(int heroID) { HeroTemplate heroT = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroID); ObjectCard obj = new ObjectCard(); Hero hero = new Hero(); hero.skill1 = heroT.getSkill1ID(); hero.skill2 = heroT.getSkill2ID(); hero.skill3 = heroT.getSkill3ID(); hero.heroid = heroT.getId(); hero.herolevel = 1; hero.heroviewid = heroT.getArtresources(); obj.GetHeroData().Init(hero); return(obj); }
/// <summary> /// 显示等级 经验 技能刷新 /// </summary> /// <param name="heroData"></param> /// <param name="level"></param> private void ShowData(int level = 1) { ObjectCard _card = new ObjectCard(); Hero hero = new Hero(); hero.skill1 = m_HeroData.getSkill1ID(); hero.skill2 = m_HeroData.getSkill2ID(); hero.skill3 = m_HeroData.getSkill3ID(); hero.heroid = m_HeroData.getId(); hero.herolevel = level; hero.heroviewid = m_HeroData.getArtresources(); _card.GetHeroData().Init(hero); m_Card = _card; ShowHeroLevelAndExp(_card); InitSkillInfo(_card); UpBtnGrayShow(); }
public void SetShowData(HeroTemplate heroT, int level = 1) { ObjectCard obj = new ObjectCard(); Hero hero = new Hero(); hero.skill1 = heroT.getSkill1ID(); hero.skill2 = heroT.getSkill2ID(); hero.skill3 = heroT.getSkill3ID(); hero.heroid = heroT.getId(); hero.herolevel = level; hero.heroviewid = heroT.getArtresources(); obj.GetHeroData().Init(hero); //HeroInfoPop.inst.Show3DModel(obj); ShowInfo(obj); Show3DModel(obj); }
public void ShowHeroT(int id, ObjectCard prevCard) { HeroTemplate heroT = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(id); ObjectCard card = new ObjectCard(); Hero hero = new Hero(); hero.heroid = id; hero.heropinji = prevCard.GetHeroData().QualityLev + 1; hero.herojinjiestar = prevCard.GetHeroData().StarLevel; hero.heroviewid = heroT.getArtresources(); hero.herolevel = prevCard.GetHeroData().Level; hero.heroskill = ""; hero.heromishu = ""; hero.heropeiyang = ""; hero.heroequip = ""; card.GetHeroData().Init(hero); UpdateHeroShow(card); }
public void Data(object data) { InnerdropTemplate value = data as InnerdropTemplate; if (value == null) { return; } int itemid = value.getObjectid(); int type = itemid / 1000000; switch (type) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid); if (_temp_res != null) { this.desc.text = GameUtils.getString(_temp_res.getName()); string _tempIconNam_1 = _temp_res.getIcon3(); this.icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_1); this.numText.text = "x" + value.getDropnum(); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid()); this.desc.text = GameUtils.getString(itemTable.getName()); this.icon.gameObject.SetActive(false); RuneIcon.SetActive(true); ShowRune(itemTable); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid()); //UI_RewardsItemManage uifigt = item.GetComponent<UI_RewardsItemManage>(); //uifigt.id = value.getObjectid(); //uifigt.typeNum = 2; this.desc.text = GameUtils.getString(itemTable.getName()); this.icon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); this.numText.text = "x" + value.getDropnum().ToString(); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(value.getObjectid()); //UI_RewardsItemManage uihero = item.GetComponent<UI_RewardsItemManage>(); //uihero.id = inner.getObjectid(); //uihero.typeNum = 3; this.desc.text = GameUtils.getString(hero.getTitleID()); //"英雄"; ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); this.icon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource()); int star = hero.getQuality(); int maxStar = hero.getMaxQuality(); this.star.Set(star, maxStar); } break; default: break; } }
public void InitIcon() { HeroTemplate ht = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroId); this.skillId = ht.getSkill1ID(); mSkillInfo = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(skillId); ArtresourceTemplate at = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(ht.getArtresources()); mMaxCoolDownTime = mSkillInfo.getCooldown() / 1000.0f; GameEventDispatcher.Inst.addEventListener(GameEventID.F_FightStateUpdate, SetSkillStatus); // GameObject button = transform.FindChild("Icon").gameObject; transform.GetComponent <Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(OnSkillClick)); //button.AddComponent<Button>().onClick.AddListener(new UnityEngine.Events.UnityAction(OnSkillClick)); m_HeroIcon = transform.FindChild("touxiang/Image(heroicon)").gameObject.GetComponent <Image>(); m_HeroIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + at.getHeadiconresource()); //hero.SetNativeSize(); m_SkillIcon = transform.FindChild("Image(skillicon)").GetComponent <Image>(); m_SkillIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + mSkillInfo.getSkillIcon()); //int groupPostion= ObjectSelf.GetInstance().Teams.GetGroupPosByHeroGuid(mHero.GetGuid()); //if (groupPostion != -1) //{ // if (groupPostion == 1) // { // m_FormPostion.sprite= UIResourceMgr.LoadSprite(common.defaultPath + "ui_zhenxing_02"); // } // else if (groupPostion == 2) // { // m_FormPostion.sprite = UIResourceMgr.LoadSprite(common.defaultPath + "ui_zhenxing_01"); // } //} //iconImg.SetNativeSize(); //Transform cdObj = iconImg.transform.FindChild("CD"); //cdIcon = cdObj.GetComponent<Image>(); //// 设置星级 //int istart = ht.getQuality(); //for (int idx = 0; idx < GlobalMembers.HeroMaxStar; idx++) //{ // mStarTrans.GetChild(idx).gameObject.SetActive(idx<istart); //} // set skill level // 设置英雄等级 //mLevel.text = (mSkillInfo.getSkillCostNum1()/30).ToString(); mLevel.text = mHero.GetHeroData().Level.ToString(); }
/// <summary> /// 填充数据 需要标识一下是哪个界面的item /// </summary> /// <param name="objHero">英雄卡牌信息</param> public void Initialize(HeroItemData objHero, ItemType type = ItemType.None) { if (type == ItemType.Empty) { parent.gameObject.SetActive(false); return; } else { parent.gameObject.SetActive(true); } this.objHero = objHero.objcet; objHeroItemData = objHero; if (objHero.objcet != null) //获取item { m_GetTran.gameObject.SetActive(true); m_NoGetTran.gameObject.SetActive(false); m_HeroLevelTran.gameObject.SetActive(true); //设置 _HeroItem = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(objHero.objcet.GetHeroData().TableID); //卡牌图标 _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(objHero.objcet.GetHeroData().GetHeroViewID()); //等级显示 m_heroLevel = objHero.objcet.GetHeroData().Level; m_HeroLevelText.text = m_heroLevel.ToString(); //设置是否上阵 int mid = -1; m_ShangZhen.gameObject.SetActive(ObjectSelf.GetInstance().Teams.IsHeroInTeam(objHero.objcet.GetGuid(), ref mid)); //设置战斗力 m_FigthVigor.text = objHero.objcet.GetHeroData().FightVigor.ToString(); //星级 m_heroStar = this.objHero.GetHeroData().StarLevel; int maxStar = _HeroItem.getMaxQuality(); for (int i = 0; i < 6; i++) { Image temp = selfTransform.FindChild("Parent/new/touxiang/Star_Image").GetChild(i).GetComponent <Image>(); if (i < m_heroStar) { temp.gameObject.SetActive(true); } else { temp.gameObject.SetActive(false); } } //m_StarsHui.gameObject.SetActive(true); m_StarsHui.gameObject.SetActive(false); } else if (objHero.objcet == null) //未获取 { m_GetTran.gameObject.SetActive(false); m_NoGetTran.gameObject.SetActive(true); m_HeroLevelTran.gameObject.SetActive(false); m_ShangZhen.gameObject.SetActive(false); m_StarsHui.gameObject.SetActive(false); for (int i = 0; i < 6; i++) { selfTransform.FindChild("Parent/new/touxiang/Star_Image").GetChild(i).gameObject.SetActive(false); } //设置 _HeroItem = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(objHero.heroTableID); //卡牌图标 _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_HeroItem.getArtresources()); //碎片合成进度 int fragmentCount = ObjectSelf.GetInstance().CommonItemContainer.GetFragmentCount(_HeroItem.GetID()); int needCount = _HeroItem.getSyntheticCount(); //Debug.LogError("process:" + fragmentCount + "max:" + needCount); if (fragmentCount >= needCount) { m_GetHeroBt.gameObject.SetActive(false); m_RecruitBt.gameObject.SetActive(true); } else { m_GetHeroBt.gameObject.SetActive(true); m_RecruitBt.gameObject.SetActive(false); } m_CompoundText.text = fragmentCount + "/" + needCount; float _baifenbi = ((float)fragmentCount / needCount); m_RectFill.sizeDelta = new Vector2((_baifenbi > 1 ? 1 :_baifenbi) * m_FillInitWidth, m_RectFill.sizeDelta.y); } m_HeroIcon.sprite = UIResourceMgr.LoadSprite(url + _Artresourcedata.getHeadiconresource()); //类型 InterfaceControler.GetInst().ShowTypeIcon(_HeroItem, m_HeroTypeIcon, m_HeroTypeText); //品质 if (objHeroItemData.objcet == null) { m_Qulit.sprite = InterfaceControler.GetInst().ReturnHeroQuailty(_HeroItem.getQuality()); } else { m_Qulit.sprite = InterfaceControler.GetInst().ReturnHeroQuailty(this.objHero.GetHeroData().QualityLev); } //Debug.Log(m_heroLevel); //名称 ChsTextTemplate chs = new ChsTextTemplate(); chs = (ChsTextTemplate)DataTemplate.GetInstance().m_ChsTextTable.getTableData(_HeroItem.getTitleID()); m_heroName = chs.languageMap["Chinese"]; HeroName.text = m_heroName; if (objHeroItemData.objcet == null) { SetTextColorByQuilt(_HeroItem.getQuality()); } else { SetTextColorByQuilt(this.objHero.GetHeroData().QualityLev); } }
public void SetGoodsItem(int iStageId) { for (int i = 0; i < objList.Count; i++) { Destroy(objList[i]); } objList.Clear(); int count = mGoodsItemGroup.childCount; for (int i = 0; i < count; ++i) { Destroy(mGoodsItemGroup.GetChild(i).gameObject); } iStageID = iStageId; //StageTemplate stageinfo = (StageTemplate)DataTemplate.GetInstance().m_StageTable.getTableData(iStageID); StageTemplate stageinfo = StageModule.GetStageTemplateById(iStageID); ////if (list.ContainsKey(iStageId)) //{ // //StageTemplate stageinfo = (StageTemplate)list[iStageID]; // if (stageinfo != null) // { // Dictionary<string, int> temp = stageinfo.getDisplaydrop(); // foreach (var info in temp) // { // GameObject gooditem = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodItem")) as GameObject; // gooditem.transform.SetParent(mGoodsItemGroup, false); // gooditem.AddComponent<UI_GoodItem>().InitFightAreaGoodItem(info.Key, info.Value); // } // } //} string displaydrop = stageinfo.m_displaydrop; if (displaydrop == "-1" || string.IsNullOrEmpty(displaydrop)) { } else { string[] displaydropList = displaydrop.Split('#'); if (displaydropList.Length == 0) { return; } for (int i = 0; i < displaydropList.Length; i++) { string[] itemList = displaydropList[i].Split('-'); switch (int.Parse(itemList[0])) { case 1: int inner = int.Parse(itemList[1]); int itemid = inner / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodRune"), transform.position, transform.rotation) as GameObject; item.transform.SetParent(mGoodsItemGroup, false); //item.transform.parent = mGoodsItemGroup; //item.transform.localScale = Vector3.one; //ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner); ItemTemplate itemTable = DataTemplate.GetInstance().GetItemTemplateById(inner); UI_DropFightItemManage uifigt = item.GetComponent <UI_DropFightItemManage>(); uifigt.typeNum = 1; uifigt.id = inner; uifigt.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mIcon.SetNativeSize(); if (int.Parse(itemList[2]) == 0) { uifigt.mProbability.SetActive(true); uifigt.mNumObj.SetActive(false); } else { uifigt.mProbability.SetActive(false); uifigt.mNumObj.SetActive(true); uifigt.mNum.text = "x" + itemList[3]; } objList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodItem"), transform.position, transform.rotation) as GameObject; item.transform.SetParent(mGoodsItemGroup, false); //item.transform.parent = mGoodsItemGroup; //item.transform.localScale = Vector3.one; //ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner); ItemTemplate itemTable = DataTemplate.GetInstance().GetItemTemplateById(inner); UI_DropFightItemManage uifigt = item.GetComponent <UI_DropFightItemManage>(); uifigt.id = inner; uifigt.typeNum = 2; uifigt.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mIcon.SetNativeSize(); if (int.Parse(itemList[2]) == 0) { uifigt.mProbability.SetActive(true); uifigt.mNumObj.SetActive(false); } else { uifigt.mProbability.SetActive(false); uifigt.mNumObj.SetActive(true); uifigt.mNum.text = "x" + itemList[3]; } objList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodHero"), transform.position, transform.rotation) as GameObject; item.transform.SetParent(mGoodsItemGroup, false); //item.transform.parent = mGoodsItemGroup; //item.transform.localScale = Vector3.one; //HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(inner); HeroTemplate hero = DataTemplate.GetInstance().GetHeroTemplateById(inner); UI_DropFightItemManage uihero = item.GetComponent <UI_DropFightItemManage>(); uihero.id = inner; uihero.typeNum = 3; //ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); ArtresourceTemplate art = DataTemplate.GetInstance().GetArtResourceTemplate(hero.getArtresources()); uihero.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource()); uihero.mIcon.SetNativeSize(); int star = hero.getQuality(); int maxStar = hero.getMaxQuality(); for (int j = 0; j < 5; j++) { uihero.starList[j].SetActive(j < star); uihero.starList[j + 5].SetActive(j < maxStar); } //for (int j = 0; j < star; j++) //{ // uihero.starList[j].SetActive(true); //} //for (int k = star; k < 5; k++) //{ // uihero.starList[k].SetActive(false); //} if (int.Parse(itemList[2]) == 0) { uihero.mProbability.SetActive(true); } else { uihero.mProbability.SetActive(false); } objList.Add(item); } break; default: break; } break; case 2: GameObject items = Instantiate(Resources.Load("UI/Prefabs/UI_Fight/UI_LGoodItem"), transform.position, transform.rotation) as GameObject; items.transform.SetParent(mGoodsItemGroup, false); //items.transform.parent = mGoodsItemGroup; //items.transform.localScale = Vector3.one; UI_DropFightItemManage uiitems = items.GetComponent <UI_DropFightItemManage>(); uiitems.id = 2; uiitems.mIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + itemList[1]); uiitems.mIcon.SetNativeSize(); if (int.Parse(itemList[2]) == 0) { uiitems.mProbability.SetActive(true); uiitems.mNumObj.SetActive(false); } else { uiitems.mProbability.SetActive(false); uiitems.mNumObj.SetActive(true); uiitems.mNum.text = "x" + itemList[3]; } if (itemList[3] == "0") { uiitems.mTipsText = null; } else { uiitems.mTipsText = itemList[3]; } objList.Add(items); break; default: break; } } } }
/// <summary> /// 初始化数据显示 /// </summary> /// <param name="heroCloneData"></param> public void InitHeroCloneItemData(HerocloneTemplate heroCloneData) { m_HeroCloneData = heroCloneData; m_HeroId = heroCloneData.getId(); m_HeroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(m_HeroId); m_AssetData = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(m_HeroData.getArtresources()); InitHeroCloneUIData(); InitHeroCloneStateUI(); }
public static string GetAwardSpriteName(int AwardId) { string _result = null; EM_OBJECT_CLASS _awardClass = GameUtils.GetObjectClassById(AwardId); switch (_awardClass) { case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: ResourceindexTemplate _resTable = DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(AwardId) as ResourceindexTemplate; if (_resTable != null) { _result = _resTable.getIcon3(); } break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: ItemTemplate _itemTable = DataTemplate.GetInstance().m_ItemTable.getTableData(AwardId) as ItemTemplate; if (_itemTable != null) { _result = _itemTable.getIcon_s(); } break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: ItemTemplate _runeTable = DataTemplate.GetInstance().m_ItemTable.getTableData(AwardId) as ItemTemplate; if (_runeTable != null) { _result = _runeTable.getIcon_s(); } break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: HeroTemplate _heroTable = DataTemplate.GetInstance().m_HeroTable.getTableData(AwardId) as HeroTemplate; if (_heroTable != null) { ArtresourceTemplate _atrResTable = DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_heroTable.getArtresources()) as ArtresourceTemplate; _result = _atrResTable.getHeadiconresource(); } break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN: ArtresourceTemplate _atrResTable1 = DataTemplate.GetInstance().m_ArtresourceTable.getTableData(AwardId) as ArtresourceTemplate; if (_atrResTable1 != null) { _result = _atrResTable1.getHeadiconresource(); } break; default: break; } return(_result); }
public void GiftShows() { // GameEventDispatcher.Inst.dispatchEvent(GameEventID.KE_KnapsackUpdateShow); for (int i = 0; i < itemList.Count; i++) { Destroy(itemList[i]); } itemList.Clear(); giftList = UI_ItemsManage._instance.giftIDList; for (int i = 0; i < giftList.Count; i++) { InnerdropTemplate inner = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(giftList[i]); int itemid = inner.getObjectid() / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: if (itemid == 1400) { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/item"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; UI_RewardsItemManage uifigt = item.GetComponent <UI_RewardsItemManage>(); ResourceindexTemplate itemT = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(inner.getObjectid()); uifigt.mName.text = GameUtils.getString(itemT.getName()); itemT.getIcon3(); uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemT.getIcon3()); uifigt.mNum.text = "x" + inner.getDropnum(); itemList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/rune"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner.getObjectid()); UI_RewardsItemManage uifigt = item.GetComponent <UI_RewardsItemManage>(); uifigt.mName.text = GameUtils.getString(itemTable.getName()); uifigt.typeNum = 1; uifigt.id = inner.getObjectid(); uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mNum.text = "x" + inner.getDropnum().ToString(); itemList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/item"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(inner.getObjectid()); UI_RewardsItemManage uifigt = item.GetComponent <UI_RewardsItemManage>(); uifigt.id = inner.getObjectid(); uifigt.typeNum = 2; uifigt.mName.text = GameUtils.getString(itemTable.getName()); uifigt.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + itemTable.getIcon()); uifigt.mNum.text = "x" + inner.getDropnum().ToString(); itemList.Add(item); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: { GameObject item = Instantiate(Resources.Load("UI/Prefabs/UI_Bag/hero"), transform.position, transform.rotation) as GameObject; item.transform.parent = mGrid; item.transform.localScale = Vector3.one; HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(inner.getObjectid()); UI_RewardsItemManage uihero = item.GetComponent <UI_RewardsItemManage>(); uihero.id = inner.getObjectid(); uihero.typeNum = 3; uihero.mName.text = GameUtils.getString(hero.getTitleID()); //"英雄"; ArtresourceTemplate art = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); uihero.mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + art.getHeadiconresource()); int star = hero.getQuality(); int maxStar = hero.getMaxQuality(); for (int j = 0; j < 5; j++) { uihero.starList[j].SetActive(j < star); uihero.starList[j + 5].SetActive(j < maxStar); } itemList.Add(item); } break; default: break; } } }
public void Init(int ID, int isReceive) { //int itemid = ID / 1000000; if (isReceive == 0) { ReceiveGo.SetActive(false); } else { ReceiveGo.SetActive(true); } InnerdropTemplate item = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(ID); NumText.text = "x" + item.getDropnum().ToString(); int _goid = item.getObjectid();//掉落物ID int itemid = item.getObjectid() / 1000000; switch (itemid) { case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: //资源 ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(_goid); if (_temp_res != null) { GoName.text = GameUtils.getString(_temp_res.getName()); string _tempIconNam_1 = _temp_res.getIcon3(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_1); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: //符文 ItemTemplate _temp_rune = (ItemTemplate)DataTemplate.GetInstance().GetItemTemplateById(_goid); if (_temp_rune != null) { GoName.text = GameUtils.getString(_temp_rune.getName()); SpriteImage.gameObject.SetActive(false); RuneIcon.SetActive(true); ShowRune(_temp_rune); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: //道具 ItemTemplate _temp_common = (ItemTemplate)DataTemplate.GetInstance().GetItemTemplateById(_goid); if (_temp_common != null) { GoName.text = GameUtils.getString(_temp_common.getName()); string _tempIconNam_3 = _temp_common.getIcon_s(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_3); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: //英雄 HeroTemplate _temp_hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_goid); if (_temp_hero != null) { GoName.text = GameUtils.getString(_temp_hero.getNameID()); int _tempIconNam_4 = _temp_hero.getArtresources(); ArtresourceTemplate _temp_Art = (ArtresourceTemplate)DataTemplate.GetInstance().GetArtResourceTemplate(_tempIconNam_4); string _tempIconNam_5 = _temp_Art.getHeadiconresource(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_5); NumText.transform.parent.gameObject.SetActive(false); this.star.gameObject.SetActive(true); int star = _temp_hero.getQuality(); int maxStar = _temp_hero.getMaxQuality(); this.star.Set(star, maxStar); } break; case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN: //皮肤 ArtresourceTemplate _temp_Art_2 = (ArtresourceTemplate)DataTemplate.GetInstance().GetArtResourceTemplate(_goid); if (_temp_Art_2 != null) { GoName.text = GameUtils.getString(_temp_Art_2.getNameID()); string _tempIconNam_6 = _temp_Art_2.getHeadiconresource(); SpriteImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _tempIconNam_6); } break; } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="heroId">英雄id</param> public void InitData(int heroId) { HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroId); if (hero == null) { Debug.LogError("找不到英雄数据 id:" + heroId); return; } m_HeroName.text = GameUtils.getString(hero.getTitleID()); InterfaceControler.GetInst().ShowTypeIcon(hero, m_Type, m_TypeText); m_FragmentCount.text = string.Format("碎片数量:<color=#FF0000>{0}</color>/{1}", ObjectSelf.GetInstance().CommonItemContainer.GetFragmentCount(hero.GetID()), hero.getSyntheticCount()); ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); m_HeroIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _Artresourcedata.getHeadiconresource()); m_Zizhi.sprite = InterfaceControler.GetInst().GetHeroAptImg(hero); m_Desc.text = GameUtils.getString(hero.getTedian()); SetTextColorByQuilt(hero.getQuality()); }
// 显示每一个英雄的数据 英雄的表数据 对应的神器 需要的英雄数量 索引 public void ShowInfo(HeroTemplate heroData, Artifact artifact, int heroNumber, int index) { _heroData = heroData; _artifact = artifact; tableID = heroData.getId(); // 星级 int quality = heroData.getQuality(); for (int i = 5; i < quality + 5; i++) { _star.transform.GetChild(i).gameObject.SetActive(true); } // icon ArtresourceTemplate artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(heroData.getArtresources()); Sprite _img = UIResourceMgr.LoadSprite(common.defaultPath + artresourcedata.getHeadiconresource()); _icon.sprite = _img; //图片 _icon.SetNativeSize(); // 名称 _name.text = GameUtils.getString(heroData.getTitleID()); ShowCount(index, heroNumber); }
public void ShowInfo(ArtifactTemplate artifact, int index, bool isReach = false) { if (isReach) { _reach.SetActive(true); _count.SetActive(false); _possess.SetActive(false); } HeroTemplate heroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(artifact.getHeroID()[index]); // 星级 int quality = heroData.getQuality(); for (int i = 5; i < quality + 5; i++) { _star.transform.GetChild(i).gameObject.SetActive(true); } // icon ArtresourceTemplate artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(heroData.getArtresources()); Sprite _img = UIResourceMgr.LoadSprite(common.defaultPath + artresourcedata.getHeadiconresource()); _icon.sprite = _img; //图片 // 名称 _name.text = GameUtils.getString(heroData.getTitleID()); // 现在的英雄数量 Text curCount = _count.transform.FindChild("CurCount").GetComponent <Text>(); curCount.text = "0"; // 需要的英雄的数量 Text needCount = _count.transform.FindChild("NeedCount").GetComponent <Text>(); needCount.text = "/" + artifact.getHeroNum()[index].ToString(); // 每一个英雄的 iD int heroID = artifact.getHeroID()[index]; _possess.transform.FindChild("Number").GetComponent <Text>().text = GetHeroCount(heroID).ToString(); }
/// <summary> /// 进阶后的属性显示 /// </summary> public void NewShow() { HeroTemplate _hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_Card.GetHeroRow().getStageUpTargetID()); int level = 0; switch (_hero.getQuality()) { case 2: mSkill.SetActive(false); break; case 3: mSkill.SetActive(true); int skillID3 = _hero.getSkill2ID(); SkillTemplate skill3 = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(skillID3); mSkillBg.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + skill3.getSkillIcon()); mSkillLevel.text = skill3.getSkillLevel().ToString(); mSkillName.text = GameUtils.getString(skill3.getSkillName()); mSkillType.text = GameUtils.getString("common_skilltypename_1"); UI_SkillTips _tips3 = new UI_SkillTips(_Card, skill3); mSkillDesText.text = _tips3.SetShow(); level = DataTemplate.GetInstance().m_GameConfig.getHero_advanced_level_3(); break; case 4: mSkill.SetActive(true); int skillID4 = _hero.getSkill3ID(); if (skillID4 != -1) { SkillTemplate skill4 = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(skillID4); mSkillBg.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + skill4.getSkillIcon()); mSkillLevel.text = skill4.getSkillLevel().ToString(); mSkillName.text = GameUtils.getString(skill4.getSkillName()); mSkillType.text = GameUtils.getString("common_skilltypename_3"); UI_SkillTips _tips4 = new UI_SkillTips(_Card, skill4); mSkillDesText.text = _tips4.SetShow(); } else { mSkill.SetActive(false); } level = DataTemplate.GetInstance().m_GameConfig.getHero_advanced_level_4(); break; case 5: level = DataTemplate.GetInstance().m_GameConfig.getHero_advanced_level_5(); mSkill.SetActive(false); break; default: break; } Hero hero = new Hero(); hero.heroid = _Card.GetHeroRow().getStageUpTargetID(); hero.herolevel = level; hero.heroviewid = _hero.getArtresources(); // ObjectCard obj = new ObjectCard(); obj.GetHeroData().Init(hero); HeroData _heroDate = obj.GetHeroData(); mLevelNew.text = obj.GetHeroData().Level + "/" + _hero.getMaxLevel(); mHpNew.text = (obj.GetBaseMaxHP() - _heroDate.TrainingMaxHP).ToString(); int nPhysicalTraniningValue = 0; if (_hero.getClientSignType()[1] == 0) { nPhysicalTraniningValue = _heroDate.TrainingPhysicalAttack; } mPhysicsAttacksNew.text = (obj.GetPhysicalBaseAttack() - nPhysicalTraniningValue).ToString(); int nMagicTraniningValue = 0; if (_hero.getClientSignType()[1] == 1) { nMagicTraniningValue = _heroDate.TrainingMagicAttack; } mMagicAttacksNew.text = (obj.GetMagicBaseAttack() - nMagicTraniningValue).ToString(); mPhysicsDefenseNew.text = (obj.GetPhysicalBaseDefence() - _heroDate.TrainingPhysicalDefence).ToString(); mMagicDefenseNew.text = (obj.GetMagicBaseDefence() - _heroDate.TrainingMagicDefence).ToString(); mAccuracyNew.text = obj.GetBaseHit().ToString(); mEvaNew.text = obj.GetBaseDodge().ToString(); mCritNew.text = obj.GetBaseCritical().ToString(); mTenacityNew.text = obj.GetBaseTenacity().ToString(); mVelocityNew.text = obj.GetBaseSpeed().ToString(); int m_HeroStar = _hero.getQuality(); int maxStar = _hero.getMaxQuality(); //星级品质界面控制 for (int i = 0; i < 5; i++) { mStarListNew[i].SetActive(i + 1 <= m_HeroStar); mStarBGListNew[i].SetActive(i + 1 <= maxStar); } //for (int i = 0; i < mStarListNew.Count; i++) //{ // if (i < _hero.getQuality()) // { // mStarListNew[i].SetActive(true); // } // else // { // mStarListNew[i].SetActive(false); // } //} mSkillMaxNew.text = _hero.getSkillMaxLevel().ToString(); Show3DModel(obj); }
//初始化掉落英雄 public void InitHero(HeroTemplate _herodata) { GoodImage = selfTransform.FindChild("Good_Image").GetComponent <Image>(); GoodName = selfTransform.FindChild("Good_Name").GetComponent <Text>(); GoodNums = selfTransform.FindChild("Good_Nums").GetComponent <Text>(); Stars = selfTransform.FindChild("Star_Image").gameObject; Stars.SetActive(true); GoodName.enabled = true; GoodNums.enabled = false; ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_herodata.getArtresources()); Sprite _img = UIResourceMgr.LoadSprite(common.defaultPath + _Artresourcedata.getHeadiconresource()); GoodImage.sprite = _img; ChsTextTemplate chs = (ChsTextTemplate)DataTemplate.GetInstance().m_ChsTextTable.getTableData(_herodata.getTitleID()); GoodName.text = chs.languageMap["Chinese"]; int starNum = _herodata.getQuality(); int maxStar = _herodata.getMaxQuality(); //for (int i = 5; i < 5 + starNum; ++i) //{ // Stars.transform.GetChild(i).GetComponent<Image>().enabled = true; //} for (int i = 0; i < 5; i++) { Stars.transform.GetChild(i).GetComponent <Image>().enabled = i < maxStar; Stars.transform.GetChild(i + 5).GetComponent <Image>().enabled = i < starNum; } }
/// <summary> /// 初始化英雄称号 头像 /// </summary> private void InitShowHeroNameAndIcon() { m_Nametxt.text = GameUtils.getString(m_HeroData.getTitleID()); m_ArtRes = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(m_HeroData.getArtresources()); m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + m_ArtRes.getHeadartresource()); }
/// <summary> /// 填充数据 /// </summary> /// <param name="id">掉落包小包id</param> public void FillData(int id) { //通过id 区分出是资源 物品 英雄 还是其他 //1400000001 - 1400999999 资源 对应数据表53 //1401000001 - 1401999999 符文 对应数据表26 //1402000001 - 1402999999 道具 对应数据表26 //1403000001 - 1403999999 英雄 对应数据表01 InnerdropTemplate innerTemplate = DataTemplate.GetInstance().GetInnerdropTemplateById(id); if (innerTemplate == null) { Debug.LogError("Innerdrop表中没有对应的id:" + id); return; } int ItemId = innerTemplate.getObjectid(); if (ItemId >= 1400000001 && ItemId <= 1400999999)//资源 { ResourceindexTemplate template = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(ItemId); if (template != null) { m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon1()); name.text = GameUtils.getString(template.getName()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(false); m_Rune.SetActive(false); m_Icon.gameObject.SetActive(true); } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } else if (ItemId >= 1402000001 && ItemId <= 1402999999) //道具 { ItemTemplate template = DataTemplate.GetInstance().GetItemTemplateById(ItemId); if (template != null) { m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon_s()); name.text = GameUtils.getString(template.getName()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(false); m_Rune.SetActive(false); m_Icon.gameObject.SetActive(true); } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } else if (ItemId >= 1401000001 && ItemId <= 1401999999) //符文 { ItemTemplate template = DataTemplate.GetInstance().GetItemTemplateById(ItemId); if (template != null) { name.text = GameUtils.getString(template.getName()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(true); m_Rune.SetActive(true); m_Icon.gameObject.SetActive(false); //星级 for (int i = 0; i < m_Stars.Length; i++) { if (template.getRune_quality() >= i + 1) { m_Stars[i].SetActive(true); } else { m_Stars[i].SetActive(false); } } //设置普通符文的类型显示 for (int i = 0; i < m_RuneCommonType.Length; i++) { if (template.getRune_type() == i + 1) { m_RuneCommonType[i].SetActive(true); } else { m_RuneCommonType[i].SetActive(false); } } //普通符文 if (template.getRune_type() < 5) { m_Rune_Common.SetActive(true); m_Rune_Special.SetActive(false); m_Rune_Common_icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon_s()); } else //特殊符文 { m_Rune_Common.SetActive(false); m_Rune_Special.SetActive(true); m_Rune_Special_icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + template.getIcon_s()); } } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } else if (ItemId >= 1403000001 && ItemId <= 1403999999) //英雄 { HeroTemplate template = DataTemplate.GetInstance().GetHeroTemplateById(ItemId); ArtresourceTemplate artTemplate = DataTemplate.GetInstance().GetArtResourceTemplate(template.getArtresources()); if (template != null) { m_Icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + artTemplate.getHeadiconresource()); name.text = GameUtils.getString(template.getTitleID()); count.text = "x" + innerTemplate.getDropnum().ToString(); m_Stars[0].transform.parent.gameObject.SetActive(true); m_Rune.SetActive(false); m_Icon.gameObject.SetActive(true); for (int i = 0; i < m_Stars.Length; i++) { if (template.getQuality() >= i + 1) { m_Stars[i].SetActive(true); } else { m_Stars[i].SetActive(false); } } } else { Debug.LogError(string.Format("找不到id{0}的为物品", ItemId)); } } }
// 英雄死亡处理 public void onHeroDie(GameEvent e) { //Debug.Log("Recieve HeroDie Call ..."); HeroData obj = (HeroData)e.data; //英雄死亡播放死亡音效 调用31artresource中diesound字段 //Debug.Log(obj.TableID); HeroTemplate _HeroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(obj.TableID); ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_HeroData.getArtresources()); AudioControler.Inst.PlaySound(_Artresourcedata.getDiesound()); if (obj != null) { UI_SkillIcon icon = mIcons[obj.GUID]; if (icon) { icon.OnHeroDead(obj.GUID); UI_FightControler.Inst.isWaitLock(obj.GUID); } } }
// ==================================== 私有接口 ===================================== /// <summary> /// 传入英雄ID加载英雄资源 【Lyq】 /// </summary> /// <param name="heroID">英雄ID</param> private void IndexHeroAsset(int heroID) { HeroTemplate _hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroID); ArtresourceTemplate _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_hero.getArtresources()); ArtresourceTemplate[] _SkinArtresourcedata = new ArtresourceTemplate[_hero.getUseableArtresource().Length]; PushNeedDownBundle(_Artresourcedata.getArtresources() + _strRes); for (int i = 0; i < _hero.getUseableArtresource().Length; ++i) { _SkinArtresourcedata[i] = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_hero.getUseableArtresource()[i]); if (_SkinArtresourcedata[i].getArtresources() == null) { continue; } PushNeedDownBundle(_SkinArtresourcedata[i].getArtresources() + _strRes); } string[] ActArtresourceData = _Artresourcedata.getActionresource(); for (int i = 0; i < ActArtresourceData.Length; ++i) { PushNeedDownBundle(ActArtresourceData[i] + _strRes); } SkillTemplate normalskill = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(_hero.getNormalskill()); for (int i = 0; i < normalskill.getBallIsticEffID().Length; i++) { PushNeedDownBundle(normalskill.getBallIsticEffID()[i] + _strRes); } PushNeedDownBundle(normalskill.getUnderAttackEffID() + _strRes); SkillTemplate m_skill1 = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(_hero.getSkill1ID()); for (int i = 0; i < m_skill1.getBallIsticEffID().Length; i++) { PushNeedDownBundle(m_skill1.getBallIsticEffID()[i] + _strRes); } PushNeedDownBundle(m_skill1.getUnderAttackEffID() + _strRes); SkillTemplate m_skill2 = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(_hero.getSkill2ID()); for (int i = 0; i < m_skill2.getBallIsticEffID().Length; i++) { Debug.Log(m_skill2.getBallIsticEffID()[i]); PushNeedDownBundle(m_skill2.getBallIsticEffID()[i] + _strRes); } PushNeedDownBundle(m_skill2.getUnderAttackEffID() + _strRes); }
private void IndexModel(HeroTemplate hero, bool isHero = false) { ArtresourceTemplate _Artresourcedata = new ArtresourceTemplate(); _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getArtresources()); PushNeedDownBundle(_Artresourcedata.getArtresources() + _strRes, isHero); ArtresourceTemplate[] _SkinArtresourcedata = new ArtresourceTemplate[hero.getUseableArtresource().Length]; for (int i = 0; i < hero.getUseableArtresource().Length; ++i) { _SkinArtresourcedata[i] = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(hero.getUseableArtresource()[i]); if (_SkinArtresourcedata[i].getArtresources() == null) { continue; } PushNeedDownBundle(_SkinArtresourcedata[i].getArtresources() + _strRes, isHero); } if (!SceneManager.Inst.NextloadScene.ToString().Contains("Battle")) { return; } string[] ActArtresourceData = _Artresourcedata.getActionresource(); for (int i = 0; i < ActArtresourceData.Length; ++i) { PushNeedDownBundle(ActArtresourceData[i] + _strRes); } }
/// <summary> /// 初始化数据 /// </summary> private void InitData() { if (PopupQueue.Count > 0) { m_id = PopupQueue.Dequeue(); m_HeroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(m_id); m_ArtResData = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(m_HeroData.getArtresources()); } }
//初始话英雄搭配卡牌信息 public void InitHeroMatchCardData(HeroTemplate carddata, ObjectCard card) { CardImage = this.transform.FindChild("Icon_Img").GetComponent <Image>(); CardNameText = this.transform.FindChild("Name_txt").GetComponent <Text>(); _Herodata = carddata; _Artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(carddata.getArtresources()); CardImage.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _Artresourcedata.getHeadartresource()); CardName = GameUtils.getString(_Herodata.getTitleID()); CardNameText.text = CardName;//名称 }
/// <summary> /// 创建队友 /// </summary> /// 如果释放目标为敌人就不创建该对象 private void CreateTeamMate() { SkillTemplate _skill = (SkillTemplate)DataTemplate.GetInstance().m_SkillTable.getTableData(m_Card.GetHeroData().SpellDataList[0].SpellID); if (_skill.getTarget() == 2) { return; } ObjectCard _teamMateCard = ObjectSelf.GetInstance().HeroContainerBag.GetHeroList()[0]; HeroTemplate _heroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(_teamMateCard.GetHeroData().TableID); //ObjectCard _teamMateCard = new ObjectCard(); //Hero hero = new Hero(); //hero.heroid = ObjectSelf.GetInstance().HeroContainerBag.GetHeroList()[0].GetHeroData().TableID; //_teamMateCard.GetHeroData().Init(hero); ArtresourceTemplate _artResData = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_heroData.getArtresources()); GameObject _heroObject = AssetLoader.Inst.GetAssetRes(_artResData.getArtresources()); if (_heroObject != null) { GameObject _obj = Instantiate(_heroObject, m_TeamMatePos.position, m_TeamMatePos.rotation) as GameObject; _obj.transform.localScale = new Vector3(2, 2, 2); SceneObjectManager.GetInstance().SceneObjectAddHero(_obj, _heroData.getId(), _teamMateCard); Animation _anim = _obj.GetComponent <Animation>(); if (_anim == null) { return; } if (_obj.GetComponent <Animation>()["Idle1"] != null) { _obj.GetComponent <Animation>().CrossFade("Idle1"); } else if (_obj.GetComponent <Animation>()["Nidle1"] != null) { _obj.GetComponent <Animation>().CrossFade("Nidle1"); } _obj.GetComponent <Animation>().wrapMode = WrapMode.Loop; } }
public void SetData(int tableID) { int quality = -1; string iconStr = string.Empty; string name = string.Empty; string hintTxt = string.Empty; string detail = string.Empty; EM_OBJECT_CLASS eoc = GameUtils.GetObjectClassById(tableID); switch (eoc) { case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE: ItemTemplate runeItemT = DataTemplate.GetInstance().GetItemTemplateById(tableID); if (runeItemT == null) { LogManager.LogError("item表格中缺少物品id=" + tableID); return; } iconStr = runeItemT.getIcon_s(); name = GameUtils.getString(runeItemT.getName()); int count = 0; if (ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, tableID, ref count)) { } else { count = 0; } hintTxt = string.Format(GameUtils.getString("tongyong_daoju1"), count); detail = GameUtils.getString(runeItemT.getDes()); quality = runeItemT.getRune_quality(); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON: ItemTemplate itemT = DataTemplate.GetInstance().GetItemTemplateById(tableID); if (itemT == null) { LogManager.LogError("item表格中缺少物品id=" + tableID); return; } iconStr = itemT.getIcon_s(); name = GameUtils.getString(itemT.getName()); int num = 0; if (ObjectSelf.GetInstance().TryGetItemCountById(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_COMMON, tableID, ref num)) { } else { num = 0; } hintTxt = string.Format(GameUtils.getString("tongyong_daoju1"), num); detail = GameUtils.getString(itemT.getDes()); quality = itemT.getQuality(); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_MONSTER: MonsterTemplate monsterT = DataTemplate.GetInstance().m_MonsterTable.getTableData(tableID) as MonsterTemplate; if (monsterT == null) { LogManager.LogError("item表格中缺少物品id=" + tableID); return; } ArtresourceTemplate artMonster = DataTemplate.GetInstance().GetArtResourceTemplate(monsterT.getArtresources()); if (artMonster == null) { LogManager.LogError("ArtResource时装表格中缺少物品id=" + monsterT.getArtresources()); return; } iconStr = artMonster.getHeadiconresource(); name = GameUtils.getString(monsterT.getMonstername()); hintTxt = string.Format("Lv{0}", monsterT.getMonsterlevel()); detail = GameUtils.getString(monsterT.getDescriptionID()); quality = monsterT.getMonsterstar(); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO: HeroTemplate heroT = DataTemplate.GetInstance().GetHeroTemplateById(tableID); if (heroT == null) { LogManager.LogError("hero表格中缺少物品id=" + tableID); return; } ArtresourceTemplate artHero = DataTemplate.GetInstance().GetArtResourceTemplate(heroT.getArtresources()); if (artHero == null) { LogManager.LogError("ArtResource时装表格中缺少物品id=" + heroT.getArtresources()); return; } iconStr = artHero.getHeadiconresource(); //英雄的初始品质为HeroTemplate中的Quality; name = string.Format(GameUtils.GetHeroNameFontColor(heroT.getQuality()), GameUtils.getString(heroT.getNameID())); ObjectCard oc = ObjectSelf.GetInstance().HeroContainerBag.FindHero(tableID); hintTxt = string.Format("Lv{0}", oc == null ? 1 : oc.GetHeroData().Level); detail = GameUtils.getString(heroT.getDescriptionID()); break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_SKIN: ArtresourceTemplate artT = DataTemplate.GetInstance().GetArtResourceTemplate(tableID); if (artT == null) { LogManager.LogError("ArtResource时装表格中缺少物品id=" + tableID); return; } iconStr = string.Empty; name = string.Empty; hintTxt = string.Empty; detail = string.Empty; break; case EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES: //资源类型点击无响应; iconStr = string.Empty; name = string.Empty; hintTxt = string.Empty; detail = string.Empty; break; default: LogManager.LogError("未处理的商城物品预览类型"); break; } name = string.Format(GameUtils.GetHeroNameFontColor(quality), name); SetData(iconStr, name, hintTxt, detail); }