public void SetDetail(ItemOfReward mreward) { _ItemOfReward = mreward; if (mreward.getCurType() == ConfigDataType.Monster) { Monster data = mreward.toMonster(Core.Data.monManager); ShowMonster(data); } else if (mreward.getCurType() == ConfigDataType.Equip) { Equipment data = mreward.toEquipment(Core.Data.EquipManager, Core.Data.gemsManager); ShowEquip(data); } else if (mreward.getCurType() == ConfigDataType.Gems) { Gems data = mreward.toGem(Core.Data.gemsManager); ShowGem(data); } else if (mreward.getCurType() == ConfigDataType.Frag) { Soul data = mreward.toSoul(Core.Data.soulManager); ShowFrag(data); } else if (mreward.getCurType() == ConfigDataType.Item) { Item item = mreward.toItem(Core.Data.itemManager); ShowItem(item); } else { RED.LogWarning("unknow reward type"); } _Head.MakePixelPerfect(); }
void SetStarPos(ItemOfReward reward) { if(CradSystemFx.GetInstance().mItemOfReward == null) { RED.LogError("card index is error"); return; } if(mIndex >= CradSystemFx.GetInstance().mItemOfReward.Length) { RED.LogError("card index is error"); return; } mMonster = reward.toMonster(Core.Data.monManager); // mMonster = CradSystemFx.GetInstance().mItemOfReward[mIndex].toMonster(Core.Data.monManager); mMonsterData = Core.Data.monManager.getMonsterByNum(mId); int mStarNum = mMonsterData.star; int mCount = 0; mCardframe.renderer.material.mainTexture = AtlasMgr.mInstance.Get3DCardFrameTexture (mStarNum); mCardbg.renderer.material.mainTexture = AtlasMgr.mInstance.Get3DCardBgTexture (mStarNum); mCardbtm.renderer.material.mainTexture = AtlasMgr.mInstance.Get3DCardBtmTexture (mStarNum); while(mCount < mStarNum) { mStarPosList.Add(new Vector3(mStarPos.x-(mCount)*mStarOffset,mStarPos.y,mStarPos.z)); mCount++; } }
void ShowIcon() { if (m_nIndex >= m_data.Length) { return; } ItemOfReward reward = m_data [m_nIndex]; if (reward.getCurType() == ConfigDataType.Monster) { Monster data = reward.toMonster(Core.Data.monManager); rewardName.text = data.config.name; AtlasMgr.mInstance.SetHeadSprite(rewardIcon, data.num.ToString()); } else if (reward.getCurType() == ConfigDataType.Equip) { Equipment data = reward.toEquipment(Core.Data.EquipManager, Core.Data.gemsManager); rewardName.text = data.ConfigEquip.name; rewardIcon.atlas = AtlasMgr.mInstance.equipAtlas; rewardIcon.spriteName = data.Num.ToString(); } else if (reward.getCurType() == ConfigDataType.Gems) { Gems data = reward.toGem(Core.Data.gemsManager); rewardName.text = data.configData.name; rewardIcon.atlas = AtlasMgr.mInstance.commonAtlas; rewardIcon.spriteName = data.configData.anime2D; } else if (reward.getCurType() == ConfigDataType.Item) { Item item = reward.toItem(Core.Data.itemManager); rewardName.text = item.configData.name; rewardIcon.atlas = AtlasMgr.mInstance.itemAtlas; // rewardIcon.spriteName = item.RtData.num.ToString (); rewardIcon.spriteName = item.configData.iconID.ToString(); } else if (reward.getCurType() == ConfigDataType.Frag) { Soul soul = reward.toSoul(Core.Data.soulManager); rewardName.text = soul.m_config.name; rewardIcon.atlas = AtlasMgr.mInstance.itemAtlas; rewardIcon.spriteName = soul.m_RTData.num.ToString(); } else { RED.LogWarning("unknow reward type"); } rewardIcon.MakePixelPerfect(); rewardNum.text = ItemNumLogic.setItemNum(reward.num, rewardNum, rewardNum.gameObject.transform.parent.gameObject.GetComponent <UISprite>()); // yangchenguang }
string GetRewardName(ItemOfReward reward) { string strName = ""; if (reward.getCurType() == ConfigDataType.Monster) { Monster data = reward.toMonster(Core.Data.monManager); strName = data.config.name; } else if (reward.getCurType() == ConfigDataType.Equip) { Equipment data = reward.toEquipment(Core.Data.EquipManager, Core.Data.gemsManager); strName = data.ConfigEquip.name; } else if (reward.getCurType() == ConfigDataType.Gems) { Gems data = reward.toGem(Core.Data.gemsManager); strName = data.configData.name; } else if (reward.getCurType() == ConfigDataType.Frag) { Soul data = reward.toSoul(Core.Data.soulManager); strName = data.m_config.name; } else if (reward.getCurType() == ConfigDataType.Item) { ConfigDataType type = DataCore.getDataType(reward.pid); if (type == ConfigDataType.Item) { Item realItem = new Item(); realItem.RtData = new ItemInfo(); realItem.RtData.num = reward.pid; realItem.configData = Core.Data.itemManager.getItemData(reward.pid); strName = realItem.configData.name; } else if (type == ConfigDataType.Frag) { Soul soul = new Soul(); soul.m_RTData = new SoulInfo(); soul.m_RTData.num = reward.pid; soul.m_RTData.count = 1; soul.m_config = Core.Data.soulManager.GetSoulConfigByNum(reward.pid); strName = soul.m_config.name; } } return(strName); }
void AddRewardToBag(ItemOfReward item) { ConfigDataType type = DataCore.getDataType(item.pid); switch (type) { case ConfigDataType.Item: { Core.Data.itemManager.addItem(item); break; } case ConfigDataType.Monster: { Monster monster = item.toMonster(Core.Data.monManager); if (monster != null) { Core.Data.monManager.AddMonter(monster); } break; } case ConfigDataType.Equip: { Core.Data.EquipManager.AddEquip(item); break; } case ConfigDataType.Gems: { Core.Data.gemsManager.AddGems(item); break; } case ConfigDataType.Frag: { Soul soul = item.toSoul(Core.Data.soulManager); if (soul != null) { Core.Data.soulManager.AddSoul(soul); } break; } } }
public void InitCardCell(ItemOfReward reward, int mid, int m_index) { Monster mon = reward.toMonster(Core.Data.monManager); if (mon != null) { GameObject obj1 = null; obj1 = PrefabLoader.loadFromPack("LS/pbLSCard1") as GameObject; if (obj1 != null) { GameObject go = NGUITools.AddChild(DBUIController.mDBUIInstance._TopRoot, obj1); go.gameObject.name = "pbLSCard"; go.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); CardSystemCell mm = go.gameObject.GetComponent <CardSystemCell>(); mSelectScript = mm; mSelectScript.SetInitPos(mid, m_index, reward); } } }
public void ShowReward(BattleSequence data) { //StartCoroutine(PlaySoundFx()); m_rewardData = data; if (data != null) { Init(data.reward.bep, data.reward.bco); if (data.reward.eco > 0) { NGUITools.SetActive(coinPos, true); //_name.text = coin.text; _name.text = Core.Data.stringManager.getString(9060) + data.reward.eco.ToString(); // yangchenguang 修改 额外奖励修改成具体奖励数 FinishedIndex = 3; } else if (data.reward.eep > 0) { NGUITools.SetActive(expPos, true); _name.text = Core.Data.stringManager.getString(9060) + data.reward.eep.ToString(); FinishedIndex = 1; } else if (data.reward.p == null || data.reward.p.Length < 1) { NGUITools.SetActive(nothingPos, true); _name.text = nothing.text; FinishedIndex = 0; } else { FinishedIndex = 2; // _name.text = other.text; ItemOfReward item = data.reward.p[0]; NGUITools.SetActive(otherPos, true); att.enabled = false; switch (item.getCurType()) { case ConfigDataType.Monster: att.enabled = true; Monster m = item.toMonster(Core.Data.monManager); if (m != null) { att.spriteName = "Attribute_" + ((int)m.RTData.Attribute).ToString(); border.spriteName = "Attribute_Border_" + ((int)m.RTData.m_nAttr).ToString(); _name.text = m.config.name; AtlasMgr.mInstance.SetHeadSprite(spr_head, item.pid.ToString()); } break; case ConfigDataType.Equip: spr_head.atlas = AtlasMgr.mInstance.equipAtlas; _name.text = Core.Data.EquipManager.getEquipConfig(item.pid).name; spr_head.spriteName = item.pid.ToString(); break; case ConfigDataType.Frag: spr_head.atlas = AtlasMgr.mInstance.itemAtlas; Soul soul = Core.Data.soulManager.GetSoulByID(item.ppid); if (soul != null) { _name.text = soul.m_config.name; } NGUITools.SetActive(att.gameObject, false); spr_head.spriteName = item.pid.ToString(); break; default: /*道具*/ spr_head.atlas = AtlasMgr.mInstance.itemAtlas; _name.text = Core.Data.itemManager.getItemData(item.pid).name; NGUITools.SetActive(att.gameObject, false); spr_head.spriteName = item.pid.ToString(); break; } spr_head.MakePixelPerfect(); } } Invoke("PlayEffect", 1f); }
public void SetData(ItemOfReward award) { m_data = award; ConfigDataType type = DataCore.getDataType(award.pid); RED.SetActive(false, sp_soul.gameObject); switch (type) { case ConfigDataType.Item: { ItemData data = Core.Data.itemManager.getItemData(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; // Spr_head.spriteName = award.pid.ToString(); Spr_head.spriteName = data.iconID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Monster: { MonsterData data = Core.Data.monManager.getMonsterByNum(award.pid); if (data != null) { AtlasMgr.mInstance.SetHeadSprite(Spr_head, award.pid.ToString()); Lab_Name.text = data.name; star.SetStar(data.star); if (sp_soul != null) { Monster mon = award.toMonster(Core.Data.monManager); int attr = (int)(mon.RTData.Attribute); sp_soul.spriteName = "Attribute_" + attr.ToString(); RED.SetActive(true, sp_soul.gameObject); } } break; } case ConfigDataType.Equip: { EquipData data = Core.Data.EquipManager.getEquipConfig(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.equipAtlas; Spr_head.spriteName = data.ID.ToString(); Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Gems: { GemData data = Core.Data.gemsManager.getGemData(award.pid); if (data != null) { Spr_head.atlas = AtlasMgr.mInstance.commonAtlas; Spr_head.spriteName = data.anime2D; Lab_Name.text = data.name; star.SetStar(data.star); } break; } case ConfigDataType.Frag: { SoulData data = Core.Data.soulManager.GetSoulConfigByNum(award.pid); switch ((ItemType)data.type) { case ItemType.Earth_Frage: case ItemType.Nameike_Frage: Spr_head.atlas = AtlasMgr.mInstance.itemAtlas; Spr_head.spriteName = data.ID.ToString(); break; case ItemType.Monster_Frage: AtlasMgr.mInstance.SetHeadSprite(Spr_head, data.updateId.ToString()); sp_soul.spriteName = "bag-0003"; sp_soul.MakePixelPerfect(); RED.SetActive(true, sp_soul.gameObject); break; case ItemType.Equip_Frage: Spr_head.atlas = AtlasMgr.mInstance.equipAtlas; Spr_head.spriteName = data.updateId.ToString(); Spr_head.MakePixelPerfect(); sp_soul.spriteName = "sui"; sp_soul.MakePixelPerfect(); RED.SetActive(true, sp_soul.gameObject); break; } Lab_Name.text = data.name; star.SetStar(data.star); break; } } Spr_head.MakePixelPerfect(); }
public void InitUI(ItemOfReward reward) { m_date = reward; ShowTxtCnt = true; if (reward.getCurType() == ConfigDataType.Monster) { Monster data = reward.toMonster(Core.Data.monManager); ShowMonster(data); } else if (reward.getCurType() == ConfigDataType.Equip) { Equipment data = reward.toEquipment(Core.Data.EquipManager, Core.Data.gemsManager); ShowEquip(data); } else if (reward.getCurType() == ConfigDataType.Gems) { Gems data = reward.toGem(Core.Data.gemsManager); ShowGem(data); } else if (reward.getCurType() == ConfigDataType.Frag) { Soul data = reward.toSoul(Core.Data.soulManager); ShowFrag(data); // if (data.m_config.type == (int)ItemType.Monster_Frage) // { // ShowSoul (data); // } // else if(data.m_config.type == (int)ItemType.Nameike_Frage || data.m_config.type == Earth_Frage) // { // ShowFrag(data); // } } else if (reward.getCurType() == ConfigDataType.Item) { Item item = reward.toItem(Core.Data.itemManager); if (reward.showpid != 0) { ConfigDataType type = DataCore.getDataType(reward.pid); if (type == ConfigDataType.Item) { Item realItem = new Item(); realItem.RtData = new ItemInfo(); realItem.RtData.num = reward.pid; realItem.configData = Core.Data.itemManager.getItemData(reward.pid); ShowItem(realItem); } else if (type == ConfigDataType.Frag) { Soul soul = new Soul(); soul.m_RTData = new SoulInfo(); soul.m_RTData.num = reward.pid; soul.m_RTData.count = 1; soul.m_config = Core.Data.soulManager.GetSoulConfigByNum(reward.pid); ShowFrag(soul); } } else { ShowItem(item); } } else if (reward.getCurType() == ConfigDataType.Frag) { Soul soul = reward.toSoul(Core.Data.soulManager); ShowFrag(soul); } else { RED.LogWarning("unknow reward type"); } if (ShowTxtCnt) { RED.SetActive(reward.num > 1, m_cntRoot); } else { RED.SetActive(false, m_cntRoot); } m_txtCnt.text = ItemNumLogic.setItemNum(reward.num, m_txtCnt, m_cntRoot.GetComponent <UISprite>()); // yangchenguang m_spIcon.MakePixelPerfect(); }