public void SetEquipment(ChangeNewEquip cne) { LevelLock info = LevelLockProvider.Instance.GetDataById(16); RoleInfo role = LobbyClient.Instance.CurrentRole; if (info.m_Level > role.Level) { return; } if (cne != null) { id = cne.id; propertyid = cne.propertyid; ItemConfig ic = ItemConfigProvider.Instance.GetDataById(id); if (ic != null) { UnityEngine.Transform tf = transform.Find("bc/goods/Texture"); if (tf != null) { UITexture ut = tf.gameObject.GetComponent <UITexture>(); if (ut != null) { UnityEngine.Texture tt = GamePokeyManager.GetTextureByPicName(ic.m_ItemTrueName); if (tt != null) { ut.mainTexture = tt; } } } tf = transform.Find("bc/goods"); if (tf != null) { UISprite us = tf.gameObject.GetComponent <UISprite>(); if (us != null) { us.spriteName = "EquipFrame" + ic.m_PropertyRank; } } } UIManager.Instance.ShowWindowByName("DynamicEquipment"); } }
void SetMailIntroduceInfo(ArkCrossEngine.MailInfo mi) { UnityEngine.Transform tfo = transform.Find("MetalFrame/RoleInfo/DragThing"); if (tfo != null) { tfo.localPosition = new UnityEngine.Vector3(0.0f, 11.0f, 0.0f); } else { return; } UnityEngine.Transform tf = tfo.Find("Label"); if (tf != null) { if (mi != null) { nowread = mi.m_MailGuid; UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { string str = ""; //str += (mi.m_Title + "\n"); str += (mi.m_SendTime.ToString("yyyy/MM/dd/HH/mm/ss") + "\n"); str += mi.m_Text; ul.text = str; } bool sign = false; UnityEngine.Vector3 pos = tf.localPosition; pos = new UnityEngine.Vector3(pos.x, pos.y - ul.localSize.y - 15, 0.0f); if (mi.m_Money != 0) { sign = true; tf = tfo.Find("Money"); if (tf != null) { UnityEngine.GameObject go = tf.gameObject; if (go != null) { UISprite us = go.GetComponent <UISprite>(); UnityEngine.Transform tf2 = go.transform.Find("Amount"); if (tf2 != null) { UILabel ul1 = tf2.gameObject.GetComponent <UILabel>(); if (ul1 != null) { ul1.text = "X " + mi.m_Money; } } go.transform.localPosition = pos; NGUITools.SetActive(go, true); if (us != null) { pos = new UnityEngine.Vector3(pos.x, pos.y - us.localSize.y - 15, 0.0f); } } } } if (mi.m_Gold != 0) { sign = true; tf = tfo.Find("Diamond"); if (tf != null) { UnityEngine.GameObject go = tf.gameObject; if (go != null) { UISprite us = go.GetComponent <UISprite>(); UnityEngine.Transform tf2 = go.transform.Find("Amount"); if (tf2 != null) { UILabel ul1 = tf2.gameObject.GetComponent <UILabel>(); if (ul1 != null) { ul1.text = "X " + mi.m_Gold; } } go.transform.localPosition = pos; NGUITools.SetActive(go, true); if (us != null) { pos = new UnityEngine.Vector3(pos.x, pos.y - us.localSize.y - 15, 0.0f); } } } } // if (mi.m_Gold != 0) { // sign = true; // tf = tfo.Find("Exp"); // if (tf != null) { // UnityEngine.GameObject go = tf.gameObject; // if (go != null) { // UISprite us = go.GetComponent<UISprite>(); // // UnityEngine.Transform tf2 = go.transform.Find("Amount"); // if (tf2 != null) { // UILabel ul1 = tf2.gameObject.GetComponent<UILabel>(); // if (ul1 != null) { // ul1.text = "X " + mi.m_Gold; // } // } // go.transform.localPosition = pos; // NGUITools.SetActive(go, true); // if (us != null) { // pos = new UnityEngine.Vector3(pos.x, pos.y - us.localSize.y - 15, 0.0f); // } // } // } // } if (mi.m_Items != null) { foreach (ArkCrossEngine.MailItem mailitem in mi.m_Items) { if (mailitem != null) { sign = true; ArkCrossEngine.ItemConfig ic = ArkCrossEngine.LogicSystem.GetItemDataById(mailitem.m_ItemId); if (ic != null) { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/Mail/MailAward")); if (go != null) { UITexture ut = go.GetComponent <UITexture>(); if (ut != null) { UnityEngine.Texture tt = GamePokeyManager.GetTextureByPicName(ic.m_ItemTrueName); if (tt != null) { ut.mainTexture = tt; } } UnityEngine.Transform tf2 = go.transform.Find("Amount"); if (tf2 != null) { UILabel ul1 = tf2.gameObject.GetComponent <UILabel>(); if (ul1 != null) { ul1.text = "X " + mailitem.m_ItemNum; } } go = NGUITools.AddChild(tfo.gameObject, go); if (go != null) { go.transform.localPosition = pos; golist.Add(go); } pos = new UnityEngine.Vector3(pos.x, pos.y - ut.localSize.y - 15, 0.0f); } } } } } if (sign) { tf = transform.Find("MetalFrame/RoleInfo/DragThing/ReceiveButton"); if (tf != null) { tf.localPosition = new UnityEngine.Vector3(0.0f, pos.y, 0.0f); NGUITools.SetActive(tf.gameObject, true); } } } } tf = transform.Find("sp_hongdi1/Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = mi.m_Title; } } // tf = transform.Find("sp_hongdi2/Label"); // if (tf != null) { // UILabel ul = tf.gameObject.GetComponent<UILabel>(); // if (ul != null) { // ul.text = mi.m_Title; // } // } }
// 物品item赋值 type哪里显示的物品, item为要显示资源框, itemid物品id, itemcount要显示的物品数量,-1默认不显示数量 public void SetItemInfo(ItemIconType type, UnityEngine.GameObject item, int itemId, int itemcount = -1) { if (item == null || itemId == 0) { return; } int nameType = 0; // 0:普通 1:s装备 , 2:碎片 UITexture icon = null; UISprite frame = null; UILabel num = null; UILabel lName = null; switch (type) { case ItemIconType.Task_Award: TaskAwardItem(item, out icon, out frame, out num); break; case ItemIconType.Sign_in: SignInItem(item, out icon, out frame, out num); nameType = 1; break; case ItemIconType.Store_item: StoreItem(item, out icon, out frame, out num); nameType = 1; break; case ItemIconType.Xhun_item: XhunItem(item, out icon, out frame, out num); break; case ItemIconType.Artifact: ArtifactItem(item, out icon, out frame, out num); break; case ItemIconType.Scene_Star: SceneStrarItem(item, out icon, out frame); break; case ItemIconType.Scene_Award: SceneAwardItem(item, out icon, out frame, out num); break; case ItemIconType.Scene_Award2: SceneAwardItem2(item, out icon, out frame, out num); break; case ItemIconType.Scene_First: SceneFirstItem(item, out icon, out frame); break; case ItemIconType.CombatWin: CombatWinItem(item, out icon, out frame, out num, out lName); break; case ItemIconType.Victory: VictorPanel(item, out icon, out frame, out lName, out num); break; case ItemIconType.Equip_slot: EquipSlot(item, out icon, out frame); nameType = 1; break; case ItemIconType.FightInfo_slot: nameType = 1; FightInfoSlot(item, out icon, out frame); break; case ItemIconType.Equip_List: nameType = 1; EquipListItem(item, out icon, out frame, out lName); break; case ItemIconType.Item_Property: ItemPropertySlot(item, out icon, out frame, out lName); break; case ItemIconType.Login_Award: LoginAwardSlot(item, out icon, out frame, out num); break; case ItemIconType.Item_Source: ItemSource(item, out icon, out frame, out lName); break; case ItemIconType.Partner_Strengthen: nameType = 1; PartnerStrengthen(item, out icon, out frame); break; case ItemIconType.Partner_Skill: nameType = 1; PartnerSkill(item, out icon, out frame, out lName); break; } ArkCrossEngine.ItemConfig ic = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(itemId); if (ic != null) { UnityEngine.Texture utt = GamePokeyManager.GetTextureByPicName(ic.m_ItemTrueName); if (utt != null && icon != null) { icon.mainTexture = utt; } if (frame != null) { if (ic.m_ShowType == 0) { if (nameType == 0) { frame.spriteName = "EquipFrame" + ic.m_PropertyRank; } else if (nameType == 1) { frame.spriteName = "SEquipFrame" + ic.m_PropertyRank; } } else if (ic.m_ShowType == 1) { frame.spriteName = "SFrame" + ic.m_PropertyRank; } } if (num != null) { if (itemcount > -1) { if (type == ItemIconType.Store_item) { num.text = "" + (itemcount > 1 ? itemcount.ToString() : ""); } else { num.text = "X" + itemcount; } } else { num.text = ""; } } if (lName != null) { lName.text = ic.m_ItemName; UnityEngine.Color col = new UnityEngine.Color(); switch (ic.m_PropertyRank) { case 1: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; case 2: col = new UnityEngine.Color(0x00 / 255f, 0xfb / 255f, 0x4a / 255f); break; case 3: col = new UnityEngine.Color(0x41 / 255f, 0xc0 / 255f, 0xff / 255f); break; case 4: col = new UnityEngine.Color(0xff / 255f, 0x00 / 255f, 0xff / 255f); break; case 5: col = new UnityEngine.Color(0xff / 255f, 0xa3 / 255f, 0x00 / 255f); break; default: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; } lName.color = col; } } }
public void SetSellGain(string money, string diamond) { sign = TaskAwardOpenForWindow.W_SellGain; for (int i = 0; i < golist.Count; i++) { if (golist[i] != null) { NGUITools.DestroyImmediate(golist[i]); } } /* * foreach (UnityEngine.GameObject go in golist) { * if (go != null) { * NGUITools.DestroyImmediate(go); * } * }*/ golist.Clear(); UnityEngine.Transform tfb = transform.Find("Back"); if (tfb != null) { if (money != null) { UnityEngine.GameObject go = ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); UnityEngine.Texture utt = GamePokeyManager.GetTextureByPicName("UI/GoodsPhoto/Money"); UITexture ut = go.GetComponent <UITexture>(); if (ut != null) { if (utt != null) { ut.mainTexture = utt; } } UnityEngine.Transform tf = go.transform.Find("Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = money; } } } } } if (diamond != null) { UnityEngine.GameObject go = ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GameTask/AwardItem") as GameObject; if (go != null) { go = NGUITools.AddChild(tfb.gameObject, go); if (go != null) { golist.Add(go); UnityEngine.Texture utt = GamePokeyManager.GetTextureByPicName("UI/GoodsPhoto/Diamond"); UITexture ut = go.GetComponent <UITexture>(); if (ut != null) { if (utt != null) { ut.mainTexture = utt; } } UnityEngine.Transform tf = go.transform.Find("Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = diamond; } } } } } } int number = golist.Count; if (number == 0) { return; } int offset = 0; int start = 0; if (number % 2 != 0) { UnityEngine.GameObject go = golist[0]; if (go != null) { go.transform.localPosition = new UnityEngine.Vector3(0.0f, 25f, 0.0f); start = 1; offset = 50; } } else { offset = -60; } for (int i = start; i < number; ++i) { int j = i; if (number % 2 == 0) { j = i + 1; } UnityEngine.GameObject go = golist[i]; if (go != null) { if (j % 2 == 0) { go.transform.localPosition = new UnityEngine.Vector3(j / 2 * (-120) - offset, 25, 0); } else { go.transform.localPosition = new UnityEngine.Vector3((j / 2 + 1) * 120 + offset, 25, 0.0f); } } } }
private void SetAwardAndPosition(UnityEngine.Transform tf, int dropid, int missionId) { ArkCrossEngine.Data_SceneDropOut dsdo = ArkCrossEngine.SceneConfigProvider.Instance.GetSceneDropOutById(dropid); UnityEngine.Vector3 pos = new UnityEngine.Vector3(80.0f, 0.0f, 0.0f); if (tf != null && dsdo != null) { if (dsdo.m_GoldSum > 0) { UnityEngine.Transform tt = tf.Find("Money"); if (tt != null) { //NGUITools.SetActive(tt.gameObject, true); pos = tt.localPosition; pos = new UnityEngine.Vector3(pos.x + 55, pos.y, 0.0f); tt = tt.Find("Label"); if (tt != null) { UILabel ul = tt.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = "X" + dsdo.m_GoldSum; } pos = new UnityEngine.Vector3(pos.x + ul.localSize.x, pos.y, 0.0f); } } } else { UnityEngine.Transform tt = tf.Find("Money"); if (tt != null) { NGUITools.SetActive(tt.gameObject, false); } } if (dsdo.m_Exp > 0) { UnityEngine.Transform tt = tf.Find("Exp"); RoleInfo roleInfo = LobbyClient.Instance.CurrentRole; if (tt != null && roleInfo != null) { //NGUITools.SetActive(tt.gameObject, true); tt.localPosition = pos; pos = tt.localPosition; pos = new UnityEngine.Vector3(pos.x + 55, pos.y, 0.0f); tt = tt.Find("Label"); if (tt != null) { UILabel ul = tt.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = "X" + roleInfo.GetMissionStateInfo().GetMissionsExpReward(missionId, roleInfo.Level); } pos = new UnityEngine.Vector3(pos.x + ul.localSize.x, pos.y, 0.0f); } } } else { UnityEngine.Transform tt = tf.Find("Exp"); if (tt != null) { NGUITools.SetActive(tt.gameObject, false); } } if (dsdo.m_Diamond > 0) { UnityEngine.Transform tt = tf.Find("Diamond"); if (tt != null) { //NGUITools.SetActive(tt.gameObject, true); tt.localPosition = pos; pos = tt.localPosition; pos = new UnityEngine.Vector3(pos.x + 55, pos.y, 0.0f); tt = tt.Find("Label"); if (tt != null) { UILabel ul = tt.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = "X" + dsdo.m_Diamond; } pos = new UnityEngine.Vector3(pos.x + ul.localSize.x, pos.y, 0.0f); } } } else { UnityEngine.Transform tt = tf.Find("Diamond"); if (tt != null) { NGUITools.SetActive(tt.gameObject, false); } } RoleInfo role_info = LobbyClient.Instance.CurrentRole; if (null != role_info) { List <int> rewardItemIdList = dsdo.GetRewardItemByHeroId(role_info.HeroId); if (null != rewardItemIdList && rewardItemIdList.Count > 0) { int count = rewardItemIdList.Count; pos = new UnityEngine.Vector3(pos.x + 30, pos.y, 0f); for (int i = 0; i < count; ++i) { ArkCrossEngine.ItemConfig ic = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(rewardItemIdList[i]); if (ic != null) { UnityEngine.GameObject go = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ArkCrossEngine.ResourceSystem.GetSharedResource("UI/GameTask/Item")); if (go != null) { go = NGUITools.AddChild(tf.gameObject, go); if (go != null) { go.transform.localPosition = pos; pos = go.transform.localPosition; pos = new UnityEngine.Vector3(pos.x + 65, pos.y, 0.0f); UnityEngine.Texture utt = GamePokeyManager.GetTextureByPicName(ic.m_ItemTrueName); UITexture ut = go.GetComponent <UITexture>(); if (ut != null) { if (utt != null) { ut.mainTexture = utt; } } UnityEngine.Transform tt = go.transform.Find("Frame"); if (tt != null) { UISprite us = tt.gameObject.GetComponent <UISprite>(); if (us != null) { us.spriteName = "EquipFrame" + ic.m_PropertyRank; } } tt = go.transform.Find("Label"); if (tt != null) { UILabel ul = tt.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = "X" + dsdo.m_ItemCountList[i]; } pos = new UnityEngine.Vector3(pos.x + ul.localSize.x, pos.y, 0.0f); } } } } } } } } }