public void SetData(SoldierInfo preInfo, SoldierInfo curInfo) { NGUIUtil.SetLableText <int>(MyHead.LblPreCombatPower, preInfo.m_combat_power); NGUIUtil.SetLableText <int>(MyHead.LblCurCombatPower, curInfo.m_combat_power); NGUIUtil.SetLableText <int>(MyHead.LblPreHp, preInfo.m_hp); NGUIUtil.SetLableText <int>(MyHead.LblCurHp, curInfo.m_hp); if (MyHead.AfterItem != null) { GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.AfterItem.transform); if (go) { CanvasItem item = go.GetComponent <CanvasItem>(); if (item) { item.SetCanvasItem(curInfo, 0, false); } } } if (MyHead.PreItem != null) { GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.PreItem.transform); if (go) { CanvasItem item = go.GetComponent <CanvasItem>(); if (item) { item.SetCanvasItem(preInfo, 0, false); } } } SetNewSkill(curInfo, preInfo); }
/// <summary> /// 加载方案项 /// </summary> private void CreateItems() { if (MyHead.FangAnTable == null) { return; } MyHead.FangAnTable.gameObject.SetActive(false); List <ShipPlan> infos = ShipPlanDC.GetAllShipPlan(); m_listFangAnBtnItem = new List <FangAnBtnItem>(infos.Count); foreach (ShipPlan info in infos) { GameObject go = NDLoad.LoadWndItem("FangAnBtnItem", MyHead.FangAnTable); if (go) { FangAnBtnItem item = go.GetComponent <FangAnBtnItem>(); if (item) { item.SetData(info); m_listFangAnBtnItem.Add(item); } NGUIUtil.SetItemPanelDepth(go, MyHead.FangAnTable.parent.gameObject); } } NGUIUtil.RepositionTable(MyHead.FangAnTable.gameObject); }
private void AddGrayItem() { float iSolid = 0; float iIntensity = 0; float iTenacity = 0; buildingM.GetStarInfoGrow(m_Info, ref iSolid, ref iIntensity, ref iTenacity); GameObject go = GameObjectLoader.LoadPath("Prefabs/UI/", "SkillIntroduceWnd", MyHead.table.transform); go.transform.localPosition = new Vector3(MyHead.table.transform.localPosition.x, go.transform.localPosition.y, go.transform.localPosition.z); SkillIntroduceWnd skilWnd = go.GetComponent <SkillIntroduceWnd>(); GameObject labGo = NDLoad.LoadWndItem("DoubleLabelItem", skilWnd.MyHead.table.transform); DoubleLabelItem item = labGo.GetComponent <DoubleLabelItem>(); item.SetData(iSolid.ToString(), "[EC0808]" + NGUIUtil.GetStringByKey(10000068) + "[-]", iIntensity.ToString(), "[40B1E1]" + NGUIUtil.GetStringByKey(10000069) + "[-]"); //MyHead在SetData中初始化,所以这句要在后面 item.MyHead.SprIcon.enabled = false; GameObject SinglabGo = NDLoad.LoadWndItem("DoubleLabelItem", skilWnd.MyHead.table.transform); DoubleLabelItem SingleItem = SinglabGo.GetComponent <DoubleLabelItem>(); SingleItem.SetData(iTenacity.ToString(), "[088454]" + NGUIUtil.GetStringByKey(10000070) + "[-]", "", ""); SingleItem.MyHead.SprIcon.enabled = false; skilWnd.MyHead.table.Reposition(); }
void CreateItems() { if (MyHead.Parent == null) { return; } int count = m_allExistSoldier.Capacity; if (count > 1) { m_fScrollOffset = 1.0f / (count - 1); MyHead.m_scrollView.scrollWheelFactor = m_fScrollOffset; } int itemIndex = 0; foreach (SoldierInfo info in m_allExistSoldier) { GameObject go = NDLoad.LoadWndItem("SoldierScrollItem", MyHead.Parent.transform); if (go != null) { SoldierScrollItem item = go.GetComponent <SoldierScrollItem>(); if (item) { m_soldierItems.Add(go.transform); item.SetUI(info); item.ItemIndex = itemIndex++; go.name = info.m_name; NGUIUtil.SetItemPanelDepth(go, MyHead.Parent.GetComponentInParent <UIPanel>()); } } } SetCurrentIndex(); DoSelectItem(CurrentIndex); NGUIUtil.RepositionTablePivot(MyHead.Parent); }
/// <summary> /// 加载头像列表 /// </summary> private void LoadCapHeadList(List <CaptionInfo> l, Transform parent) { if (parent == null) { return; } EmptyCapHeadList(parent.gameObject); if (l == null || l.Count == 0) { return; } foreach (CaptionInfo capInfo in l) { GameObject go = NDLoad.LoadWndItem("CaptionScrollItem", parent); if (go != null) { CaptionScrollItem item = go.GetComponent <CaptionScrollItem>(); if (item) { m_CaptionList.Add(capInfo.m_captionid, item); item.SetCaption(capInfo); NGUIUtil.SetItemPanelDepth(go, parent.GetComponentInParent <UIPanel>()); } } } NGUIUtil.RepositionTable(parent.gameObject); }
/// <summary> /// 创建装备 /// </summary> /// <param name="equipID">装备ID</param> /// <param name="posIndex">装备穿戴位置</param> private void CreateEquipItem(int dItemID, int posIndex) { GameObject equipPos = MyHead.SoldierEquipList[posIndex]; GameObject go = NDLoad.LoadWndItem("EquipmentItem", equipPos.transform); EquipmentItem item = go.GetComponent <EquipmentItem>(); if (item) { m_lEquipItems.Add(item); item.SetData(dItemID, posIndex, m_soldierInfo); if (item.EquipPutType == EquipmentPutType.CanPut) { m_lCanEquips.Add(item); item.bGuideSelect = true; } else if (item.EquipPutType == EquipmentPutType.None && m_tNotCanEquip == null) { m_tNotCanEquip = item.transform; item.bGuideSelect = true; } else if ((item.EquipPutType == EquipmentPutType.ReadyCombine || item.EquipPutType == EquipmentPutType.NoCanCombine) && m_tCanGet == null) { m_tCanGet = item.transform; item.bGuideSelect = true; } } }
/// <summary> /// 设置炮弹兵详细数据 /// </summary> private void SetSoldierReward() { List <SoldierInfo> l = new List <SoldierInfo>(); CmCarbon.GetPlayerSoldier(ref l); if (MyHead.Datatable == null) { return; } for (int i = 0; i < l.Count; i++) { GameObject go = NDLoad.LoadWndItem("RoleRewardItem", MyHead.Datatable.transform); if (go != null) { RoleRewardItem item = go.GetComponent <RoleRewardItem>(); if (item != null) { item.SetRoleRewardItem(l[i]); } } } MyHead.Datatable.enabled = true; NGUIUtil.RepositionTablePivot(MyHead.Datatable.gameObject); }
private void AddBuild(BuildInfo WareHouse) { //判断是否已有该类型的建筑 foreach (CanvasItem item in m_lItems) { if (item != null) { // 已有 if (item.Equalof(WareHouse) == true) { item.SetCanvasItem(WareHouse); item.ShowBearDestroy(true); return; } } } ; //新的建筑 GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.ListParent.transform); if (go) { CanvasItem item = go.GetComponent <CanvasItem>(); if (item) { m_lItems.Add(item); item.SetCanvasItem(WareHouse); item.ShowBearDestroy(true); } } }
/// <summary> /// 加载头像列表. /// </summary> private void LoadCapHeadList(List <CaptionInfo> l, UITable Parent, int itemType = 1) { if (Parent == null) { return; } if (l == null || l.Count == 0) { return; } foreach (CaptionInfo capInfo in l) { GameObject go = NDLoad.LoadWndItem("BlackScienceItem", Parent.transform); if (go != null) { BlackScienceItem item = go.GetComponent <BlackScienceItem>(); if (item) { m_CaptionList.Add(capInfo.m_captionid, item); item.SetCaption(capInfo, this); item.ItemType = itemType; } } } Parent.Reposition(); }
public void SetStageSoldier() { if (MyHead.RoleTable == null) { return; } List <int> list = new List <int>(); CmCarbon.GetAttackList(ref list); foreach (int DataID in list) { SoldierInfo s = CmCarbon.GetSoldierInfo(LifeMCamp.ATTACK, DataID); if (s == null) { continue; } GameObject go = NDLoad.LoadWndItem("RoleViewItem", MyHead.RoleTable.transform); if (go != null) { RoleViewItem item = go.GetComponent <RoleViewItem>(); if (item != null) { item.SetRoleRewardItem(s); } } } MyHead.Rewardtable.enabled = true; MyHead.Rewardtable.Reposition(); }
public void SetUI() { string [] l = m_shape.Split(','); m_height = l.Length; for (int i = 0; i < l.Length; i++) { for (int j = 0; j < l[i].Length; j++) { GameObject go = NDLoad.LoadWndItem("ShipModelItem", TableList[i].transform); if (go != null) { ShipModelItem item = go.GetComponent <ShipModelItem>(); if (item != null) { if (l[i][j] == '1') { item.SetSize(GetSingleWidth(), GetSingleWidth()); } //有可能是甲板层. else if (l[i][j] == '0') { //如果他的下一层不为0则是甲板层. bool deck = BattleEnvironmentM.CheckIsDeckGrid(l, i, j); item.SetSize(GetSingleWidth(), GetSingleWidth(), deck); item.gameObject.SetActive(deck); } } } } TableList[i].Reposition(); TableList[i].repositionNow = true; } StartCoroutine(RepositionTable(1)); }
private void CreateBanner() { GameObject go = NDLoad.LoadWndItem("PdbbbItem", MyHead.Parent.transform); PdbbbItem Pitem = go.GetComponent <PdbbbItem>(); if (Pitem != null && Pitem.MyHead.Table != null) { GameObject Banner = NDLoad.LoadWndItem("PdbbbBanner", Pitem.MyHead.Table.transform); PdbbbBanner banner = Banner.GetComponent <PdbbbBanner>(); if (banner != null) { banner.SetLabelText(NGUIUtil.GetStringByKey(10000027)); } Pitem.MyHead.Table.Reposition(); Pitem.MyHead.Table.repositionNow = true; UIPanel panel = MyHead.Parent.transform.parent.gameObject.GetComponent <UIPanel>(); float x = 150f; if (panel != null) { UISprite spr = Pitem.GetComponentInChildren <UISprite>(); if (spr != null) { x = (panel.width - spr.width) / 2; } } Pitem.MyHead.Table.transform.localPosition = new Vector3(x, Pitem.MyHead.Table.transform.localPosition.y, Pitem.MyHead.Table.transform.localPosition.z); } }
private void AddDoubleLabelItem(string text1, string text1Name, string text2, string text2Name) { GameObject go = NDLoad.LoadWndItem("DoubleLabelItem", MyHead.table.transform); DoubleLabelItem item = go.GetComponent <DoubleLabelItem>(); item.SetData(text1, text1Name, text2, text1Name); }
private void SetSoldierReward(List <SoldierInfo> lsoldier) { if (lsoldier == null || lsoldier.Count == 0) { return; } if (MyHead.Datatable == null) { return; } for (int i = 0; i < lsoldier.Count; i++) { GameObject go = NDLoad.LoadWndItem("RoleRewardItem", MyHead.Datatable.transform); if (go != null) { RoleRewardItem item = go.GetComponent <RoleRewardItem>(); if (item != null) { item.SetRoleRewardItem(lsoldier[i]); } } } MyHead.Datatable.enabled = true; NGUIUtil.RepositionTablePivot(MyHead.Datatable.gameObject); }
public void CreatItem(SoldierInfo soldierInfo) { GameObject go = NDLoad.LoadWndItem("CombatRoleItem", MyHead.table.transform); //根据类型切换头像 CombatRoleItem c = go.GetComponent <CombatRoleItem>(); if (c != null) { c.SetSoldierUI(soldierInfo); c.m_isPlayer = false; c.SetHp(1.0f); c.SetAnger(0.0f); } foreach (treasure.TreasureObjInfo tdi in m_status) { if (tdi.type == 2 && soldierInfo.ID == tdi.objid) { float hp = tdi.hp == -1 ? 1 : tdi.hp * 1.0f / soldierInfo.m_hp; c.SetHp(hp); float anger = tdi.mp * 1.0f / ConfigM.GetAngerK(1); c.SetAnger(anger); } } // NGUIUtil.SetItemPanelDepth(c.gameObject, MyHead.table.GetComponentInParent<UIPanel>()); }
private void SetUI() { int total = 0; foreach (ItemTypeInfo item in m_litem) { GameObject go = NDLoad.LoadWndItem("ItemUseConfirmItem", MyHead.ItemList.transform); if (go != null) { ItemUseConfirmItem itemgo = go.GetComponent <ItemUseConfirmItem>(); if (itemgo != null) { itemgo.SetItem(item); } } total += int.Parse(item.m_args) * item.Num; } if (m_stype == 44) { MyHead.SprRes1.spriteName = "icon011"; } else if (m_stype == 45) { MyHead.SprRes1.spriteName = "icon013"; } MyHead.LblRes1Num.text = "X" + total; }
private void InitTrapRoomUI() { GoClickBuildBtns = NDLoad.LoadWndItem("ClickBuildBtns", WndManager.GetWndRoot().transform); if (GoClickBuildBtns) { m_v3GoClickBuildBtns = GoClickBuildBtns.transform.position; ClickBuildBtns btns = GoClickBuildBtns.GetComponent <ClickBuildBtns>(); if (btns) { //btns.BtnInfo.OnClickEventHandler += BtnInfo_OnClickEventHandler; btns.BtnReturnBag.OnClickEventHandler += BtnReutrnBag_OnClickEventHandler; //btns.BtnUpgrade.OnClickEventHandler += BtnUpgrade_OnClickEventHandler; //btns.BtnDeleteSoldier.OnClickEventHandler += BtnDeleteSoldier_OnClickEventHandler; btns.BtnSetTransGate.OnClickEventHandler += BtnSetTransGate_OnClickEventHandler; } GoClickBuildBtns.SetActive(false); } SetClickBuildBtns(false, false); if (m_Core.m_type == ShipBuildType.BuildRoom) { BuildProperty lifeobj = GetComponent <BuildProperty>(); if (lifeobj != null && lifeobj.GetModeType() == 1605) { SetClickBuildBtns(false, true); } } }
private void SetUI() { GameObject go = NDLoad.LoadWndItem("TrapViewItem", MyHead.trap); if (go != null) { TrapViewItem item = go.GetComponent <TrapViewItem>(); if (item != null) { item.SetBuildInfo(m_build, null, TrapState.Exit, 2); } } sdata.s_itemtypeInfo info = ItemM.GetItemInfo(m_build.fragmentTypeID); if (info != null) { NGUIUtil.Set2DSprite(MyHead.Spr2DItem, "Textures/item/" + info.icon); } else { NGUIUtil.DebugLog("m_build.fragmentTypeID =" + m_build.fragmentTypeID + "not found!"); } NGUIUtil.SetLableText(MyHead.LblItemNum, m_FragmentNum); NGUIUtil.SetLableText(MyHead.LblWoodNum, m_wood); NGUIUtil.SetLableText(MyHead.LblGoldNum, m_coin); }
private void SetStageItemReward() { List <int> lItem = StageDC.GetStageReward(); if (lItem != null && lItem.Count > 0) { if (MyHead.Rewardtable == null) { return; } for (int i = 0; i < lItem.Count; i++) { GameObject go = NDLoad.LoadWndItem("RewardItem", MyHead.Rewardtable.transform); if (go != null) { RewardItem item = go.GetComponent <RewardItem>(); if (item != null) { item.SetRewardItem(lItem[i], 0); } } } MyHead.Rewardtable.enabled = true; MyHead.Rewardtable.Reposition(); } }
private void AddLabelItem(string text, int iFontSize = 0) { GameObject go = NDLoad.LoadWndItem("SingleLabelItem", MyHead.table.transform); SingleLabelItem item = go.GetComponent <SingleLabelItem>(); item.MyHead.label01.overflowMethod = UILabel.Overflow.ResizeHeight; item.SetData(text, iFontSize); }
private void AddDoubleLabelItem(string text1Name, string text1, string text2Name, string text2, int iFontSize = 0) { GameObject go = NDLoad.LoadWndItem("DoubleLabelItem", MyHead.table.transform); DoubleLabelItem item = go.GetComponent <DoubleLabelItem>(); item.SetData(text1, text1Name, text2, text2Name, iFontSize); item.MyHead.SprIcon.enabled = false; }
/// <summary> /// 创建已召唤炮弹兵 /// </summary> private void CreateExistHero() { int count = 0; PdbbbItem pdbbItem = null; for (int i = 0; i < m_allExistSoldier.Count; i++) { SoldierInfo info = m_allExistSoldier[i]; if (m_iSelectLocation != -1) { if (m_iSelectLocation != info.m_loaction) { continue; } } if (info == null) { continue; } m_iCreatCount++; if (count % 4 == 0) { pdbbItem = null; GameObject go = NDLoad.LoadWndItem("PdbbbItem", MyHead.Parent.transform); pdbbItem = go.GetComponent <PdbbbItem>(); if (pdbbItem != null) { pdbbItem.MyHead.Table.pivot = UITablePivot.Pivot.Left; } } count++; if (pdbbItem != null && pdbbItem.MyHead.Table != null) { GameObject go = NDLoad.LoadWndItem("ExistHeroItem", pdbbItem.MyHead.Table.transform); if (go != null) { ExistHeroItem item = go.GetComponent <ExistHeroItem>(); if (item != null) { item.SetData(info); m_ExistSoldier.Add(item); if (info.CheckSoldierJinJie() && m_CanJinJieitem == null) { m_CanJinJieitem = item; item.BGuideSelect = true; } if (info.CheckHaveSkillUp() && m_tCanSkillUp == null) { m_tCanSkillUp = item; item.BGuideSelect = true; } } } pdbbItem.MyHead.Table.Reposition(); } } }
private void AddItem02() { GameObject go = NDLoad.LoadWndItem("HeroIntroduceItem02", MyHead.AttributesTable.transform); HeroIntroduceItem02 item = go.GetComponent <HeroIntroduceItem02>(); if (item) { item.SetUI(m_soldierInfo.m_desc); } }
private void LoadAllUnit() { for (int i = 0; i < 32; i++) { GameObject go = NDLoad.LoadWndItem("DesignUnitItem", Parent); go.name = "Item" + i; m_lGo.Add(go); } NGUIUtil.RepositionTable(Parent.gameObject); }
private void CreateItem(SoldierInfo s) { GameObject go = NDLoad.LoadWndItem("CanvasItem", MyHead.Parent); CanvasItem c = go.GetComponent <CanvasItem>(); if (c != null) { c.SetCanvasItem(s, 1); } }
/// <summary> /// 创建已召唤炮弹兵 /// </summary> private void CreateTrap(List <BuildInfo> BuildList, TrapState trapState) { if (trapState == TrapState.Exit) { m_canShengji = null; } if (BuildList == null || BuildList.Count == 0) { return; } if (MyHead.Parent == null) { NGUIUtil.DebugLog("ShipCanvasDialogWnd ListParent!!!"); return; } if (trapState == TrapState.CanNotSum) { CreateBanner(); } PdbbbItem pbbItem = null; int count = 0; for (int i = 0; i < BuildList.Count; i++) { if (count % 4 == 0) { pbbItem = null; GameObject go = NDLoad.LoadWndItem("PdbbbItem", MyHead.Parent.transform); pbbItem = go.GetComponent <PdbbbItem>(); } count++; if (pbbItem != null && pbbItem.MyHead.Table != null) { GameObject viewgo = NDLoad.LoadWndItem("TrapViewItem", pbbItem.MyHead.Table.transform); if (viewgo != null) { TrapViewItem item = viewgo.GetComponent <TrapViewItem>(); if (item != null) { item.SetBuildInfo(BuildList[i], this, trapState); if (null == m_canShengji && trapState == TrapState.Exit) { CanLevelResult LevResult = buildingM.GetLevelCanUP(BuildList[i]); if (LevResult == CanLevelResult.CanUp) { m_canShengji = item; } } } } } } }
private void AddShengJieBtn() { GameObject go = NDLoad.LoadWndItem("BtnShengjieView", MyHead.table.transform); m_BtnShengJie = go.GetComponentInChildren <UIButton>(); if (m_BtnShengJie != null) { m_BtnShengJie.OnClickEventHandler += BtnShengJie_OnClickEventHandler; } }
void LoadItems() { GameObject go = NDLoad.LoadWndItem("PdbFromItem", MyHead.Parent.transform); if (go != null) { PdbFromItem item = go.GetComponent <PdbFromItem>(); item.Info = Info; } NGUIUtil.RepositionTable(MyHead.Parent); }
private void CreateSkillItem(SoldierSkill soldierSkill) { GameObject go = NDLoad.LoadWndItem("BigSkillItem", MyHead.SkillTable); if (go) { BigSkillItem item = go.GetComponent <BigSkillItem>(); if (item != null) { item.SetData(soldierSkill, false); } } }
private void SetStageItemReward(int itemType, int itemID, int itemCount) { GameObject go = NDLoad.LoadWndItem("RewardItem", MyHead.Rewardtable.transform); if (go != null) { RewardItem item = go.GetComponent <RewardItem>(); if (item != null) { item.SetRewardItem(itemType, itemID, itemCount); } } }