private void OnClickSoldierSelect(IUIObject obj) { NewListBox newListBox = obj as NewListBox; if (obj == null || null == newListBox) { return; } IUIListObject selectedItem = newListBox.SelectedItem; UIListItemContainer uIListItemContainer = (UIListItemContainer)selectedItem; if (null == uIListItemContainer) { return; } if (uIListItemContainer.data != null) { this.m_SelectSolID = (long)uIListItemContainer.Data; } if (this.m_pkParentDlg == null || !this.m_pkParentDlg.Visible) { this.CloseForm(null); } Protocol_Item.Item_Use(this.m_pkEquipItem, this.m_SelectSolID); this.Close(); }
private void OnSoldierView(IUIListObject obj) { UIListItemContainer uIListItemContainer = (UIListItemContainer)obj; if (null == uIListItemContainer) { return; } long num = -1L; if (uIListItemContainer.data != null) { num = (long)uIListItemContainer.data; } if (num != 0L) { return; } SolMilitarySelectDlg solMilitarySelectDlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.SOLMILITARYSELECT_DLG) as SolMilitarySelectDlg; if (solMilitarySelectDlg != null) { solMilitarySelectDlg.SetLocationByForm(this); solMilitarySelectDlg.SetFocus(); solMilitarySelectDlg.SolSortType = 2; solMilitarySelectDlg.SetSortList(); } }
void RefreshParent(string parentName) { List <IUIListObject> parentLists; if (allParents.TryGetValue(parentName, out parentLists)) { foreach (IUIListObject item in parentLists) { list.RemoveItem(item, false); } UIListItemContainer parent = null; foreach (UIListItemContainer item in allParContainers) { if (item != null && item.gameObject.name == parentName) { parent = item; break; } } if (parent != null) { UIListItemContainer parContainer = parent.GetComponent <UIListItemContainer>(); for (int i = 1; i <= parentLists.Count; i++) { IUIListObject item = parentLists[i - 1]; list.InsertItem(item, parContainer.Index + i); } } } }
List <IUIListObject> GetParent(string parName) { List <IUIListObject> parent; if (!allParents.TryGetValue(parName, out parent)) { IUIListObject newItem = list.CreateItem(parentPrefab, parName); newItem.gameObject.name = parName; UIStateToggleBtn radioBtn = newItem.gameObject.GetComponent <UIStateToggleBtn>(); if (radioBtn != null) { radioBtn.AddValueChangedDelegate(ParentValueChanged); } UIListItemContainer container = newItem.gameObject.GetComponent <UIListItemContainer>(); if (container != null) { allParContainers.Add(container); } parent = new List <IUIListObject>(); allParents.Add(parName, parent); } return(parent); }
public void SetData(DropDownList dw) { if (null == dw) { return; } if (dw.GetParentCheck() && NrTSingleton <FormsManager> .Instance.IsForm(dw.ParentGID)) { MsgBoxAutoSellUI msgBoxAutoSellUI = NrTSingleton <FormsManager> .Instance.GetForm(dw.ParentGID) as MsgBoxAutoSellUI; if (msgBoxAutoSellUI != null) { base.SetLocation(base.GetLocation().x, base.GetLocationY() + 80f, msgBoxAutoSellUI.GetLocation().z - 2f); } } this.m_kParentDropDownList = dw; this.m_kListBox.Clear(); for (int i = 0; i < dw.Count; i++) { IUIListObject item = dw.GetItem(i); if (item != null) { ListItem listItem = (ListItem)item.Data; if (listItem != null) { ListItem listItem2 = new ListItem(); listItem2.SetColumnStr(0, listItem.GetColumnStr(0)); listItem2.Key = listItem2; this.m_kListBox.Add(listItem2); } } } this.m_kListBox.RepositionItems(); }
private void ReqWebImageCallback(Texture2D txtr, object _param) { long guildID = NrTSingleton <NewGuildManager> .Instance.GetGuildID(); int num = (int)_param; if (num < 0) { return; } if (txtr != null) { IUIListObject iUIListObject = this.m_nlbWaitGuildInfo.GetItem(num); if (iUIListObject != null) { NewListItem newListItem = new NewListItem(this.m_nlbWaitGuildInfo.ColumnNum, true, string.Empty); if (this.m_TempGuildInfo[num].nGuildID == guildID) { newListItem.SetListItemData(0, NrTSingleton <CTextParser> .Instance.GetTextColor("1107") + this.m_TempGuildInfo[num].strGuildName, null, null, null); } else { newListItem.SetListItemData(0, this.m_TempGuildInfo[num].strGuildName, null, null, null); } newListItem.SetListItemData(1, txtr, true, null, null, null); this.m_nlbWaitGuildInfo.RemoveAdd(num, newListItem); } } this.m_nTotalCount++; if (this.m_nTotalCount == this.m_TempGuildInfo.Count) { this.m_nlbWaitGuildInfo.RepositionItems(); } }
void AddNewItem(string text) { // Instantiates a new item from the item object and // sets any attached text object to "Level 1": IUIListObject newItem = list.CreateItem(chatItem); SpriteText spriteText = newItem.gameObject.transform.FindChild("text").gameObject.GetComponent <SpriteText>(); if (spriteText != null) { spriteText.Text = UIString.Instance.ParserString_Runtime(text); } UISystem.Instance.AddHollowWindow(newItem.gameObject); list.ScrollToItem(newItem, 0.0f, EZAnimation.EASING_TYPE.Linear); if (list.UnviewableArea > 0) { list.slider.Hide(false); } else { list.slider.Hide(true); } }
private void SelectCommandList(IUIObject a_cUIObject) { IUIListObject selectItem = this.m_lbCommandList.GetSelectItem(); if (selectItem.Data != null) { } }
void RefreshList() { RefreshButtons(); _saveScrollList.ClearList(true); foreach (string levelName in LevelDataManager.instance.SaveList) { IUIListObject listObject = _saveScrollList.CreateItem(_saveListItemPrefab.gameObject, levelName); listObject.SetInputDelegate(HandleHandleEZInputDelegate); } }
public void AddItem(string childText, string childId, string parentText) { childText = UIString.Instance.ParserString_Runtime(childText); parentText = UIString.Instance.ParserString_Runtime(parentText); List <IUIListObject> parent = GetParent(parentText); IUIListObject child = NewChild(childText, childId); parent.Add(child); RefreshParent(parentText); }
IUIListObject NewChild(string name, string goName) { IUIListObject newItem = list.CreateItem(childPrefab, name); newItem.gameObject.name = goName; UIButton btn = newItem.gameObject.GetComponent <UIButton>(); if (btn != null) { btn.AddInputDelegate(ItemsInputDelegate); } return(newItem); }
void SetWorld(IUIListObject item) { Debug.Log("snapped item: "+item.Index); /*for (int i = 0; i < 5; i++) { //scrollLevels.GetItem(i).gameObject.SetActive(false); Debug.Log ("scrollGetItem: " + scrollLevels.GetItem(i).gameObject.name); }*/ //Debug.Log ("scrollItem: " + item); actualWorld = item.Index +1; //Debug.Log ("actualWorldScroll: " + actualWorld); worldTitle.Text = worldTitles[actualWorld-1]; }
public void ClickGuildInfo(IUIObject obj) { IUIListObject selectItem = this.m_nlbGuildList.GetSelectItem(); if (selectItem == null) { return; } GS_NEWGUILD_DETAILINFO_REQ gS_NEWGUILD_DETAILINFO_REQ = new GS_NEWGUILD_DETAILINFO_REQ(); gS_NEWGUILD_DETAILINFO_REQ.i64GuildID = (long)selectItem.Data; SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_NEWGUILD_DETAILINFO_REQ, gS_NEWGUILD_DETAILINFO_REQ); this.SetEnableControl(false); }
private void BtnClickListBox(IUIObject obj) { IUIListObject selectItem = this.m_lxList.GetSelectItem(); COMMUNITY_USER_INFO cOMMUNITY_USER_INFO = (COMMUNITY_USER_INFO)selectItem.Data; int num = this.m_lxList.SelectedItem.GetIndex(); num = Mathf.Clamp(num, 0, this.m_CommunityUserList.Count); cOMMUNITY_USER_INFO = this.m_CommunityUserList[num]; bool flag = false; if (cOMMUNITY_USER_INFO != null) { if (cOMMUNITY_USER_INFO.byLocation <= 0 || !cOMMUNITY_USER_INFO.bConnect) { flag = NrTSingleton <CRightClickMenu> .Instance.CreateUI(cOMMUNITY_USER_INFO.i64PersonID, 0, cOMMUNITY_USER_INFO.strName, CRightClickMenu.KIND.OTHER_FRIEND_LOGOFF, CRightClickMenu.TYPE.SIMPLE_SECTION_1, false); } else if (Client.m_MyWS != (long)cOMMUNITY_USER_INFO.i32WorldID || Client.m_MyCH != cOMMUNITY_USER_INFO.byLocation) { Debug.Log(string.Concat(new object[] { Client.m_MyWS, "!=", cOMMUNITY_USER_INFO.i32WorldID, ",", Client.m_MyCH, "!=", cOMMUNITY_USER_INFO.byLocation })); flag = NrTSingleton <CRightClickMenu> .Instance.CreateUI(cOMMUNITY_USER_INFO.i64PersonID, 0, cOMMUNITY_USER_INFO.strName, CRightClickMenu.KIND.OTHER_FRIEND_DIFF_SV_CLICK, CRightClickMenu.TYPE.SIMPLE_SECTION_3, false); } else { flag = NrTSingleton <CRightClickMenu> .Instance.CreateUI(cOMMUNITY_USER_INFO.i64PersonID, 0, cOMMUNITY_USER_INFO.strName, CRightClickMenu.KIND.OTHER_FRIEND_SAME_SV_CLICK, CRightClickMenu.TYPE.SIMPLE_SECTION_3, false); } } else { NrTSingleton <CRightClickMenu> .Instance.CloseUI(CRightClickMenu.CLOSEOPTION.CLICK); } if (flag) { float x = this.m_lxList.GetSize().x; float height = 28f; float left = base.GetLocation().x + this.m_lxList.GetLocation().x + this.m_lxList.GetSelectItem().gameObject.transform.localPosition.x; float top = base.GetLocationY() + this.m_lxList.GetLocationY() + -this.m_lxList.GetSelectItem().gameObject.transform.localPosition.y; Rect windowRect = new Rect(left, top, x, height); NrTSingleton <CRightClickMenu> .Instance.SetWindowRect(windowRect); } }
private void OnClickList(IUIObject a_cUIObject) { IUIListObject selectItem = this.m_ListBox_ListBox37.GetSelectItem(); if (selectItem != null && selectItem.Data is ITEM && this.m_gid == G_ID.QUESTGIVEITEM_DLG) { QuestGiveItemDlg questGiveItemDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.QUESTGIVEITEM_DLG) as QuestGiveItemDlg; if (questGiveItemDlg != null) { questGiveItemDlg.SetItemSlot((ITEM)selectItem.Data); this.Close(); } } }
void SetWorld(IUIListObject item) { Debug.Log("snapped item: " + item.Index); /*for (int i = 0; i < 5; i++) * { * //scrollLevels.GetItem(i).gameObject.SetActive(false); * Debug.Log ("scrollGetItem: " + scrollLevels.GetItem(i).gameObject.name); * }*/ //Debug.Log ("scrollItem: " + item); actualWorld = item.Index + 1; //Debug.Log ("actualWorldScroll: " + actualWorld); worldTitle.Text = worldTitles[actualWorld - 1]; }
public void SetRoomStateEffect() { NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo; short num = NrTSingleton <BabelTowerManager> .Instance.GetLastGuildBossFloor(); short guildBossLastFloor = NrTSingleton <ContentsLimitManager> .Instance.GetGuildBossLastFloor(); if (0 < guildBossLastFloor && guildBossLastFloor < num) { num = guildBossLastFloor; } short num2 = num / 5; if (num % 5 != 0) { num2 += 1; } bool flag = true; for (int i = 0; i < (int)num2; i++) { IUIListObject item = this.m_lbFloor.GetItem(i); for (int j = 5; j > 0; j--) { if ((int)num >= ((int)num2 - i) * 5 - (5 - j)) { string effectKey = string.Empty; NEWGUILD_MY_BOSS_ROOMINFO guildBossMyRoomInfo = kMyCharInfo.GetGuildBossMyRoomInfo(num); if (guildBossMyRoomInfo != null) { effectKey = this.GetRoomStateEffect(guildBossMyRoomInfo.byRoomState); } else { effectKey = this.GetRoomStateEffect(0); } int num3 = j - 1; UIButton uIButton = ((UIListItemContainer)item).GetElement(num3 + 1) as UIButton; if (uIButton != null) { NrTSingleton <FormsManager> .Instance.AttachEffectKey(effectKey, uIButton, uIButton.GetSize()); } num -= 1; } } flag = !flag; } }
public void RefreshNewScroll() { //Conect with Server and Fill the Arrays stored in Flow newPanel.transform.FindChild("NewScroll").GetComponent <UIScrollList>().ClearList(true); foreach (CustomStage c in Flow.customStages) { if (c.isNew && c.isChallenge) { IUIListObject g = newPanel.transform.FindChild("NewScroll").GetComponent <UIScrollList>().CreateItem(newContainerPrefab); g.transform.FindChild("Name").GetComponent <SpriteText>().Text = c.creatorName; g.transform.FindChild("Mines").GetComponent <SpriteText>().Text = "Mines: " + c.numberOfMines; g.transform.FindChild("StageName").GetComponent <SpriteText>().Text = c.name; g.transform.FindChild("World" + (1 + c.world).ToString()).gameObject.SetActive(true); } } }
private int ListBox_Index(long _friend_personid) { for (int i = 0; i < this.m_lbCommunityList.Count; i++) { IUIListObject item = this.m_lbCommunityList.GetItem(i); if (item != null) { COMMUNITY_USER_INFO cOMMUNITY_USER_INFO = (COMMUNITY_USER_INFO)item.Data; if (cOMMUNITY_USER_INFO != null && cOMMUNITY_USER_INFO.i64PersonID == _friend_personid) { return(i); } } } return(-1); }
public void RefreshOldScroll() { //Conect with Server and Fill the Arrays stored in Flow oldPanel.transform.FindChild("OldScroll").GetComponent <UIScrollList>().ClearList(true); foreach (CustomStage c in Flow.customStages) { if (!c.isNew && c.isChallenge) { IUIListObject g = oldPanel.transform.FindChild("OldScroll").GetComponent <UIScrollList>().CreateItem(oldContainerPrefab); g.transform.FindChild("Name").GetComponent <SpriteText>().Text = c.name; g.transform.FindChild("Mines").GetComponent <SpriteText>().Text = "Mines: " + c.numberOfMines; g.transform.FindChild("Host").GetComponent <SpriteText>().Text = "Hosted by " + c.creatorName; g.transform.FindChild("World" + (1 + c.world).ToString()).gameObject.SetActive(true); g.transform.GetComponent <ChallengesButton>().challengeIndex = Flow.customStages.IndexOf(c); } } }
public void SetListAttackGuildMark() { for (int i = 0; i < this.m_lbCurrentStatus.Count; i++) { IUIListObject item = this.m_lbCurrentStatus.GetItem(i); if (item != null) { MINE_GUILD_CURRENTSTATUS_INFO mINE_GUILD_CURRENTSTATUS_INFO = item.Data as MINE_GUILD_CURRENTSTATUS_INFO; if (mINE_GUILD_CURRENTSTATUS_INFO != null) { if (mINE_GUILD_CURRENTSTATUS_INFO.byCurrentStatusType == 1 || mINE_GUILD_CURRENTSTATUS_INFO.byCurrentStatusType == 0) { if (mINE_GUILD_CURRENTSTATUS_INFO.i64AttackGuildID > 0L) { DrawTexture drawTexture = ((UIListItemContainer)item).GetElement(8) as DrawTexture; if (drawTexture != null) { if (mINE_GUILD_CURRENTSTATUS_INFO.i64AttackGuildID == NrTSingleton <NewGuildManager> .Instance.GetGuildID() || !mINE_GUILD_CURRENTSTATUS_INFO.bIsAttackGuildNameHide) { string guildPortraitURL = NrTSingleton <NkCharManager> .Instance.GetGuildPortraitURL(mINE_GUILD_CURRENTSTATUS_INFO.i64AttackGuildID); WebFileCache.RequestImageWebFile(guildPortraitURL, new WebFileCache.ReqTextureCallback(this.ReqWebGuildImageCallback), drawTexture); } else { drawTexture.SetTexture("Win_BI_Nomark"); } } } } else if (mINE_GUILD_CURRENTSTATUS_INFO.byCurrentStatusType == 2) { DrawTexture drawTexture2 = ((UIListItemContainer)item).GetElement(8) as DrawTexture; if (drawTexture2 != null) { NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo; drawTexture2.SetTexture(eCharImageType.SMALL, kMyCharInfo.GetImgFaceCharKind(), -1, string.Empty); } } } } } }
void AddNewItem(string text) { // Instantiates a new item from the item object and // sets any attached text object to "Level 1": if (list.Count >= 1) { IUIListObject lastItem = list.GetItem(list.Count - 1); if (lastItem.Text == text) { return; } } IUIListObject newItem = list.CreateItem(textPrefab, text); UISystem.Instance.AddHollowWindow(newItem.gameObject); list.ScrollToItem(newItem, 0.5f, EZAnimation.EASING_TYPE.Linear); }
void ToggleParend(GameObject parent) { if (parent == null) { return; } UIStateToggleBtn radioBtn = parent.GetComponent <UIStateToggleBtn>(); if (radioBtn == null) { return; } else if (radioBtn.Data == null) { radioBtn.Data = true; return; } string parName = parent.name; List <IUIListObject> parentLists; if (allParents.TryGetValue(parName, out parentLists)) { if (radioBtn.StateNum == 0) { foreach (IUIListObject item in parentLists) { list.RemoveItem(item, false); } } else { UIListItemContainer parContainer = parent.GetComponent <UIListItemContainer>(); for (int i = 1; i <= parentLists.Count; i++) { IUIListObject item = parentLists[i - 1]; list.InsertItem(item, parContainer.Index + i); } } } }
public void OnChangeDifficult(object a_oObject) { DailyDungeon_Main_Dlg dailyDungeon_Main_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DAILYDUNGEON_MAIN) as DailyDungeon_Main_Dlg; if (dailyDungeon_Main_Dlg == null) { this.Close(); return; } IUIListObject selectItem = this.m_nlDifficulty.GetSelectItem(); EVENT_DAILY_DUNGEON_INFO eVENT_DAILY_DUNGEON_INFO = selectItem.Data as EVENT_DAILY_DUNGEON_INFO; if ((int)dailyDungeon_Main_Dlg.Difficult == (int)eVENT_DAILY_DUNGEON_INFO.i8Difficulty) { this.Close(); return; } dailyDungeon_Main_Dlg.SetDifficuly(eVENT_DAILY_DUNGEON_INFO.i8Difficulty); this.Close(); }
public void Open_Node(int a_nIndex) { IUIListObject item = base.GetItem(a_nIndex); if (item == null) { return; } TreeView.TreeNode treeNode = item.Data as TreeView.TreeNode; if (treeNode == null) { return; } if (!treeNode.IsOpen) { base.SetSelectedItem(a_nIndex); this.ClickButton(null); this.ExpandNode(treeNode, a_nIndex); } }
public void UpdateTime() { for (int i = 0; i < this.m_lbCurrentStatus.Count; i++) { IUIListObject item = this.m_lbCurrentStatus.GetItem(i); EXPEDITION_CURRENT_STATE_INFO eXPEDITION_CURRENT_STATE_INFO = item.Data as EXPEDITION_CURRENT_STATE_INFO; if (eXPEDITION_CURRENT_STATE_INFO != null) { Label label = ((UIListItemContainer)item).GetElement(1) as Label; if (null != label) { label.Text = this.GetExpeditionState(eXPEDITION_CURRENT_STATE_INFO); } UIButton uIButton = ((UIListItemContainer)item).GetElement(0) as UIButton; if (null != uIButton) { if (eXPEDITION_CURRENT_STATE_INFO.ui8ExpeditionState == 1) { uIButton.Visible = true; } else if (eXPEDITION_CURRENT_STATE_INFO.ui8ExpeditionState == 2 || eXPEDITION_CURRENT_STATE_INFO.ui8ExpeditionState == 3) { if (eXPEDITION_CURRENT_STATE_INFO.i64Time == eXPEDITION_CURRENT_STATE_INFO.i64CheckBattleTime) { uIButton.Visible = true; } else { uIButton.Visible = false; } } else { uIButton.Visible = false; } } } } }
public void BtClickJoinRoom(IUIObject obj) { IUIListObject selectItem = this.m_lbOpenRoomList.GetSelectItem(); if (selectItem == null) { return; } BABELTOWER_OPENROOMLIST bABELTOWER_OPENROOMLIST = selectItem.Data as BABELTOWER_OPENROOMLIST; if (bABELTOWER_OPENROOMLIST != null) { GS_BABELTOWER_GOLOBBY_REQ gS_BABELTOWER_GOLOBBY_REQ = new GS_BABELTOWER_GOLOBBY_REQ(); gS_BABELTOWER_GOLOBBY_REQ.mode = 2; gS_BABELTOWER_GOLOBBY_REQ.babel_floor = bABELTOWER_OPENROOMLIST.i16Floor; gS_BABELTOWER_GOLOBBY_REQ.babel_subfloor = bABELTOWER_OPENROOMLIST.i16SubFloor; gS_BABELTOWER_GOLOBBY_REQ.Babel_FloorType = this.m_nFloorType; gS_BABELTOWER_GOLOBBY_REQ.nPersonID = bABELTOWER_OPENROOMLIST.i64LeaderPersonID; gS_BABELTOWER_GOLOBBY_REQ.Babel_FloorType = bABELTOWER_OPENROOMLIST.i16FloorType; SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_BABELTOWER_GOLOBBY_REQ, gS_BABELTOWER_GOLOBBY_REQ); } this.Close(); }
private void On_Mouse_Over(IUIObject a_oObject) { ImageView imageView = a_oObject as ImageView; if (imageView != null) { IUIListObject mouseItem = imageView.MouseItem; if (mouseItem != null) { ImageSlot imageSlot = mouseItem.Data as ImageSlot; if (imageSlot != null && imageSlot.c_oItem != null) { ITEM iTEM = new ITEM(); iTEM.Set(imageSlot.c_oItem as ITEM); if (iTEM != null && iTEM.m_nItemUnique > 0) { ItemTooltipDlg itemTooltipDlg = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.ITEMTOOLTIP_DLG) as ItemTooltipDlg; itemTooltipDlg.Set_Tooltip((G_ID)base.WindowID, iTEM, null, false); } } } } }
/// <summary> /// Scrolls the list to the specified item in the specified /// number of seconds. /// </summary> /// <param name="item">The item to scroll to.</param> /// <param name="scrollTime">The number of seconds the scroll should last.</param> public void ScrollToItem(IUIListObject item, float scrollTime) { ScrollToItem(item, scrollTime, snapEasing); }
/// <summary> /// Removes the item at the specified index. /// Remaining items are repositioned to fill /// the gap. /// The removed item is destroyed if 'destroy' /// is true. Otherwise, it is deactivated. /// </summary> /// <param name="index">Index of the item to remove.</param> public void RemoveItem(int index, bool destroy) { if (index < 0 || index >= items.Count) return; // Remove the item from our container: if (container != null) container.RemoveChild(items[index].gameObject); // Unselect it, if necessary: if(selectedItem == items[index]) { selectedItem = null; items[index].selected = false; } // Null out our last clicked control if this is it: if (lastClickedControl != null && (lastClickedControl == items[index] || (lastClickedControl.Container != null && lastClickedControl.Container.Equals(items[index]))) ) lastClickedControl = null; // Remove the item from our visible list, if it's there: visibleItems.Remove(items[index]); if (destroy) { items[index].Delete(); Destroy(items[index].gameObject); } else { // Move to the root of the hierarchy: items[index].transform.parent = null; // Deactivate: items[index].gameObject.SetActiveRecursively(false); } items.RemoveAt(index); // Reposition our items: PositionItems(); }
/// <summary> /// Empties the contents of the list entirely. /// Destroys the items if instructed, otherwise /// it just deactivates them. /// </summary> /// <param name="destroy">When true, the list items are actually destroyed. Otherwise, they are deactivated.</param> public void ClearList(bool destroy) { RemoveItemsFromContainer(); selectedItem = null; lastClickedControl = null; for(int i=0; i<items.Count; ++i) { // Move them out of the mover object // and into the root of the scene // hierarchy: items[i].transform.parent = null; if (destroy) Destroy(items[i].gameObject); else items[i].gameObject.SetActiveRecursively(false); } visibleItems.Clear(); items.Clear(); PositionItems(); }
protected float GetXAlignLeft(IUIListObject item) { return (viewableAreaActual.x * -0.5f) - item.TopLeftEdge.x; }
// Called by a list item when it is selected: public void DidSelect(IUIListObject item) { if (selectedItem != null) selectedItem.selected = false; selectedItem = item; item.selected = true; /* if (scriptWithMethodToInvoke != null) scriptWithMethodToInvoke.Invoke(methodToInvokeOnSelect, 0); if (changeDelegate != null) changeDelegate(this); */ DidClick((IUIObject)item); }
/// <summary> /// Inserts a list item at the specified position in the list. /// </summary> /// <param name="item">Reference to the item to be inserted into the list.</param> /// <param name="position">0-based index of the position in the list where the item will be placed.</param> /// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param> public void InsertItem(IUIListObject item, int position, string text) { InsertItem(item, position, text, false); }
protected float GetYAlignBottom(IUIListObject item) { return (viewableAreaActual.y * -0.5f) - item.BottomRightEdge.y; }
public void SelectEventNpcDelegate( IUIObject obj) { if( obj == eventList && eventList.SelectedItem != null) { AsSoundManager.Instance.PlaySound( "Sound/Interface/S6002_EFF_Button", Vector3.zero, false); m_CurDownListItem = eventList.SelectedItem; } }
/// <summary> /// Inserts a list item at the specified position in the list. /// </summary> /// <param name="item">Reference to the item to be inserted into the list.</param> /// <param name="position">0-based index of the position in the list where the item will be placed.</param> /// <param name="doEasing">Indicates whether easing should be performed to reposition other items in the list when making room for the inserted item. Only applies if the item is being inserted before another item.</param> public void InsertItem(IUIListObject item, int position, bool doEasing) { InsertItem(item, position, null, doEasing); }
private void EventNpcUpdateCheck() { if( null == m_CurDownListItem) return; m_fTooltipOpenTime += Time.deltaTime; if( 0.1f > m_fTooltipOpenTime) return; for( int i=0; i<m_eventListItemList.Count; ++i) { if( m_CurDownListItem == m_eventListItemList[i]) { if( m_EventListData.body.Length <= i) { Debug.LogError( "AsNpcMenu::EventNpcUpdateCheck()[ over index : " + i); break; } TooltipMgr.Instance.OpenEventDlg( m_EventListData.body[i]); break; } } m_fTooltipOpenTime = 0f; m_CurDownListItem = null; }
/// <summary> /// Inserts a list item at the specified position in the list. /// </summary> /// <param name="item">Reference to the item to be inserted into the list.</param> /// <param name="position">0-based index of the position in the list where the item will be placed.</param> /// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param> public void InsertItem(IUIListObject item, int position, string text) { IUIListObject lastItem; float contentDelta; // Make sure Start() has already run: if (!m_started) Start(); // See if the item needs to be enabled: if(activateWhenAdding) if (!((Component)item).gameObject.active) ((Component)item).gameObject.SetActiveRecursively(true); // Put the item in the correct layer: item.gameObject.layer = gameObject.layer; // Add the item to our container: if (container != null) container.AddChild(item.gameObject); //------------------------------------- // Position our item: //------------------------------------- item.transform.parent = mover.transform; #if AUTO_ORIENT_ITEMS item.transform.localRotation = Quaternion.identity; #endif #if AUTO_SCALE_ITEMS item.transform.localScale = Vector3.one; #endif // Go ahead and get the item in the mover's plane // on the local Z-axis. This must be done here // before anything that follows because if we are // using a perspective camera and these are newly // created items, their Start() will be called for // the first time when FindOuterEdges() is called // either by us, or by the Text property, and if // the item isn't already positioned relative to // the camera, then its size will be calculated // wrong. item.transform.localPosition = Vector3.zero; if(text != null) item.Text = text; item.SetList(this); // Compute the edges of the item: item.FindOuterEdges(); item.UpdateCollider(); // Clamp our position: position = Mathf.Clamp(position, 0, items.Count); // Hide the item by default: item.Hide(true); if (!item.Managed) item.gameObject.SetActiveRecursively(false); // See if we can just add it to the end: if(position == items.Count) { if (orientation == ORIENTATION.HORIZONTAL) { if (items.Count > 0) { lastItem = items[items.Count - 1]; item.transform.localPosition = new Vector3(lastItem.transform.localPosition.x + lastItem.BottomRightEdge.x + itemSpacing - item.TopLeftEdge.x, 0); } else { item.transform.localPosition = new Vector3((viewableArea.x * -0.5f) - item.TopLeftEdge.x + itemSpacing, 0); } contentDelta = item.BottomRightEdge.x - item.TopLeftEdge.x + itemSpacing; } else { if (items.Count > 0) { lastItem = items[items.Count - 1]; item.transform.localPosition = new Vector3(0, lastItem.transform.localPosition.y + lastItem.BottomRightEdge.y - itemSpacing - item.TopLeftEdge.y); } else { item.transform.localPosition = new Vector3(0, (viewableArea.y * 0.5f) - item.TopLeftEdge.y - itemSpacing); } contentDelta = item.TopLeftEdge.y - item.BottomRightEdge.y + itemSpacing; } item.Index = items.Count; items.Add(item); UpdateContentExtents(contentDelta); ClipItems(); } else { // Else, insert the item in the midst of our list: items.Insert(position, item); PositionItems(); } }
public void ClearListSync(bool destroy) { RemoveItemsFromContainer(); List<IUIListObject> listDestroy = new List<IUIListObject>(); selectedItem = null; lastClickedControl = null; for (int i = 0; i < items.Count; ++i) { // Move them out of the mover object // and into the root of the scene // hierarchy: items[i].transform.parent = null; #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 items[i].gameObject.SetActive(false); #else items[i].gameObject.SetActiveRecursively(false); #endif if (destroy) listDestroy.Add(items[i]); } if (destroy) { foreach (IUIListObject item in listDestroy) { if (item.gameObject != null) Destroy(item.gameObject); } } visibleItems.Clear(); items.Clear(); PositionItems(); }
/// <summary> /// Adds an item to the end of the list. /// NOTE: For proper appearance, list items should each /// be of uniform width when the list is vertical, and of /// uniform height when the list is horizontal. Besides /// that, list items can vary in size. /// </summary> /// <param name="item">Reference to the list item to be added.</param> /// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param> public void AddItem(IUIListObject item, string text) { if (!m_awake) Awake(); if (!m_started) Start(); InsertItem(item, items.Count, text); }
/// <summary> /// Removes the specified item. /// Remaining items are repositioned to fill /// the gap. /// The removed item is destroyed if 'destroy' /// is true. Otherwise, it is deactivated. /// </summary> /// <param name="item">Reference to the item to be removed.</param> /// <param name="destroy">Whether or not to destroy the item being removed.</param> public void RemoveItem(IUIListObject item, bool destroy) { RemoveItem(item, destroy, false); }
protected float GetYAlignTop(IUIListObject item) { return (viewableAreaActual.y * 0.5f) - item.TopLeftEdge.y; }
public void UpdateFloor(short floor) { NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo; short num = floor / 5; if (floor % 5 != 0) { num += 1; } short num2 = (floor - 1) % 5; NewListItem newListItem = this.CreateItem(num); if (newListItem != null) { bool flag = this.GuildBossRewardCheck(); if (flag) { this.m_dtNotice.Visible = true; } for (int i = 0; i < this.m_lbFloor.Count; i++) { IUIListObject item = this.m_lbFloor.GetItem(i); if (item != null && (short)item.Data == num) { NEWGUILD_MY_BOSS_ROOMINFO guildBossMyRoomInfo = kMyCharInfo.GetGuildBossMyRoomInfo(floor); bool guildBossRoomStateInfo = kMyCharInfo.GetGuildBossRoomStateInfo(floor); DrawTexture drawTexture = ((UIListItemContainer)item).GetElement((int)(51 + num2)) as DrawTexture; if (guildBossMyRoomInfo != null && guildBossMyRoomInfo.byRoomState != 0) { drawTexture.Visible = guildBossRoomStateInfo; drawTexture.SetTexture("Win_I_Notice04"); } UIButton uIButton = ((UIListItemContainer)item).GetElement((int)(num2 + 1)) as UIButton; DrawTexture drawTexture2 = ((UIListItemContainer)item).GetElement((int)(56 + num2 * 2)) as DrawTexture; if (drawTexture2 != null) { drawTexture2.Visible = false; } ItemTexture itemTexture = ((UIListItemContainer)item).GetElement((int)(56 + num2 * 2 + 1)) as ItemTexture; if (itemTexture != null) { itemTexture.Visible = false; } if (guildBossMyRoomInfo != null) { if (guildBossMyRoomInfo.i64PlayPersonID > 0L) { if (drawTexture2 != null) { drawTexture2.Visible = true; } if (itemTexture != null) { itemTexture.Visible = true; } NewGuildMember memberInfoFromPersonID = NrTSingleton <NewGuildManager> .Instance.GetMemberInfoFromPersonID(guildBossMyRoomInfo.i64PlayPersonID); if (memberInfoFromPersonID != null) { if (memberInfoFromPersonID.GetPortrait() != null) { itemTexture.SetTexture(memberInfoFromPersonID.GetPortrait()); itemTexture.AddValueChangedDelegate(new EZValueChangedDelegate(this.BtnClickMemberInfo)); itemTexture.Data = guildBossMyRoomInfo.i64PlayPersonID; } else { itemTexture.SetSolImageTexure(eCharImageType.SMALL, new NkListSolInfo { SolCharKind = memberInfoFromPersonID.GetFaceCharKind(), SolGrade = -1, SolLevel = memberInfoFromPersonID.GetLevel() }, false); itemTexture.AddValueChangedDelegate(new EZValueChangedDelegate(this.BtnClickMemberInfo)); itemTexture.Data = guildBossMyRoomInfo.i64PlayPersonID; } } } string effectKey = string.Empty; if (guildBossMyRoomInfo != null) { effectKey = this.GetRoomStateEffect(guildBossMyRoomInfo.byRoomState); } else { effectKey = this.GetRoomStateEffect(0); } if (uIButton != null) { uIButton.DeleteChildEffect(); NrTSingleton <FormsManager> .Instance.AttachEffectKey(effectKey, uIButton, uIButton.GetSize()); } } break; } } } }
protected float GetXCentered(IUIListObject item) { return 0; }
private void ClickList(IUIObject obj) { if (this.m_eType == ExchangePointDlg.TYPE.TYPE_TICKET) { UIListItemContainer selectedItem = this.m_kList.SelectedItem; if (null == selectedItem) { return; } ITEM iTEM = (ITEM)selectedItem.Data; if (iTEM == null) { return; } this.m_kSelectItem.SetItemTexture(iTEM); this.m_kSelectItem.Data = iTEM; this.m_nSelectItemUnique = iTEM.m_nItemUnique; this.m_nSelectItemNum = 1; this.m_kSellNum.MaxValue = (long)iTEM.m_nItemNum; this.m_kSellNum.Text = this.m_nSelectItemNum.ToString(); this.m_kSelectItemName.Text = NrTSingleton <ItemManager> .Instance.GetItemNameByItemUnique(iTEM.m_nItemUnique); this.GetPoint(iTEM); this.SetVisible(true); } else if (this.m_eType == ExchangePointDlg.TYPE.TYPE_EQUIPITEM) { for (int i = 0; i < this.m_kList.Count; i++) { UIListItemContainer item = this.m_kList.GetItem(i); if (!(null == item)) { if (item.IsSelected()) { item.GetElement(5).Visible = true; } else { item.GetElement(5).Visible = false; } } } this.InitRemoveItemID(); int num = this.m_kList.SelectedItems.Count; if (num == 0) { this.InitSelectItemInfo(); return; } if (num > 10) { return; } num = 0; long num2 = 0L; bool flag = false; foreach (IUIListObject current in this.m_kList.SelectedItems.Values) { IUIListObject iUIListObject = current; if (iUIListObject != null) { if (num > 10) { break; } ITEM iTEM2 = (ITEM)iUIListObject.Data; if (iTEM2 != null) { ITEMINFO itemInfo = NrTSingleton <ItemManager> .Instance.GetItemInfo(iTEM2.m_nItemUnique); if (itemInfo != null) { int itemMakeRank = iTEM2.m_nOption[2]; ITEM_SELL itemSellData = NrTSingleton <ITEM_SELL_Manager> .Instance.GetItemSellData(itemInfo.m_nQualityLevel, itemMakeRank); if (itemSellData != null) { long num3 = (long)(itemSellData.nItemSellMoney / NrTSingleton <PointManager> .Instance.GetItemBuyRate()); if (0L < num3) { if (!flag) { this.m_kSelectItem.SetItemTexture(iTEM2); this.m_kSelectItem.Data = iTEM2; this.m_kSelectItemName.Text = NrTSingleton <ItemManager> .Instance.GetItemNameByItemUnique(iTEM2.m_nItemUnique); flag = true; } this.m_nRemoveItemID[num++] = iTEM2.m_nItemID; num2 += num3; } } } } } } string empty = string.Empty; if (1 < this.m_kList.SelectedItems.Count) { NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("295"), "count", this.m_kList.SelectedItems.Count - 1 }); this.m_kEquipCount.Text = empty; } else { this.m_kEquipCount.Text = string.Empty; } this.m_kEquipPointName.Visible = true; empty = string.Empty; NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2256"), "count", num2 }); this.m_kTotalEquipPoint.Text = empty; } this.SetPoint(); }
protected float GetXAlignRight(IUIListObject item) { return (viewableAreaActual.x * 0.5f) - item.BottomRightEdge.x; }
/// <summary> /// Sets the item at the specified index as the /// currently selected item. /// </summary> /// <param name="index">The zero-based index of the item.</param> public void SetSelectedItem(int index) { if (index < 0 || index >= items.Count) { // Unset the previous selection: if (selectedItem != null) selectedItem.selected = false; selectedItem = null; return; } IUIListObject item = items[index]; // Unset the previous selection: if (selectedItem != null) selectedItem.selected = false; selectedItem = item; item.selected = true; }
/// <summary> /// Sets the item at the specified index as the /// currently selected item. /// </summary> /// <param name="index">The zero-based index of the item.</param> public void SetSelectedItem(int index) { IUIListObject oldSel = selectedItem; if (index < 0 || index >= items.Count) { // Unset the previous selection: if (selectedItem != null) selectedItem.selected = false; selectedItem = null; // If the selected item changed, // notify our delegate: if (oldSel != selectedItem) { if (changeDelegate != null) changeDelegate(this); } return; } IUIListObject item = items[index]; // Unset the previous selection: if (selectedItem != null) selectedItem.selected = false; selectedItem = item; item.selected = true; // If the selected item changed, // notify our delegate: if (oldSel != selectedItem) { if (changeDelegate != null) changeDelegate(this); } }
/// <summary> /// Inserts a list item at the specified position in the list. /// </summary> /// <param name="item">Reference to the item to be inserted into the list.</param> /// <param name="position">0-based index of the position in the list where the item will be placed.</param> /// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param> public void InsertItem(IUIListObject item, int position, string text) { // Make sure Awake() has already run: if (!m_awake) Awake(); // Make sure Start() has already run: if (!m_started) Start(); // See if the item needs to be enabled: if (activateWhenAdding) { if (!((Component)item).gameObject.active) ((Component)item).gameObject.SetActiveRecursively(true); } // Now deactivate again if the list itself is deactivated: if(!gameObject.active) ((Component)item).gameObject.SetActiveRecursively(false); // Put the item in the correct layer: item.gameObject.layer = gameObject.layer; // Add the item to our container: if (container != null) container.AddChild(item.gameObject); //------------------------------------- // Position our item: //------------------------------------- item.transform.parent = mover.transform; #if AUTO_ORIENT_ITEMS item.transform.localRotation = Quaternion.identity; #endif #if AUTO_SCALE_ITEMS item.transform.localScale = Vector3.one; #endif // Go ahead and get the item in the mover's plane // on the local Z-axis. This must be done here // before anything that follows because if we are // using a perspective camera and these are newly // created items, their Start() will be called for // the first time when FindOuterEdges() is called // either by us, or by the Text property, and if // the item isn't already positioned relative to // the camera, then its size will be calculated // wrong. item.transform.localPosition = Vector3.zero; item.SetList(this); if (text != null) item.Text = text; // Clamp our position: position = Mathf.Clamp(position, 0, items.Count); // Hide the item by default: if (clipContents) { item.Hide(true); if (!item.Managed) item.gameObject.SetActiveRecursively(false); } item.Index = position; // Add the item: newItems.Add(item); if (position != items.Count) { itemsInserted = true; items.Insert(position, item); // Add to our visible items so that // it will be clipped in the next go: if (visibleItems.Count == 0) { visibleItems.Add(item); } else if (item.Index > 0) { int prevIdx = visibleItems.IndexOf(items[item.Index - 1]); if (prevIdx == -1) { // See if it should be added to the beginning or the end: if (visibleItems[0].Index >= item.Index) visibleItems.Insert(0, item); else visibleItems.Add(item); } else visibleItems.Insert(prevIdx + 1, item); } } else { items.Add(item); // Add to our visible items so that // it will be clipped in the next go: visibleItems.Add(item); } // See if we need to go ahead and position the item: if(positionItemsImmediately) { if (itemsInserted) RepositionItems(); else PositionNewItems(); } // Compute the edges of the item: /* item.FindOuterEdges(); item.UpdateCollider(); // See if we can just add it to the end: if(position == items.Count) { float x=0, y=0; bool addItemSpacing = false; if (orientation == ORIENTATION.HORIZONTAL) { // Find the X-coordinate: if (items.Count > 0) { addItemSpacing = true; // We will be adding itemSpacing lastItem = items[items.Count - 1]; if (direction == DIRECTION.TtoB_LtoR) x = lastItem.transform.localPosition.x + lastItem.BottomRightEdge.x + itemSpacing - item.TopLeftEdge.x; else x = lastItem.transform.localPosition.x - lastItem.BottomRightEdge.x - itemSpacing + item.TopLeftEdge.x; } else { if (spacingAtEnds) addItemSpacing = true; // We will be adding itemSpacing if (direction == DIRECTION.TtoB_LtoR) x = (viewableAreaActual.x * -0.5f) - item.TopLeftEdge.x + ((spacingAtEnds) ? (itemSpacing) : (0)) + extraEndSpacing; else x = (viewableAreaActual.x * 0.5f) - item.BottomRightEdge.x - ((spacingAtEnds) ? (itemSpacing) : (0)) - extraEndSpacing; } // Find the Y-coordinate: switch(alignment) { case ALIGNMENT.CENTER: y = 0; break; case ALIGNMENT.LEFT_TOP: y = (viewableAreaActual.y * 0.5f) - item.TopLeftEdge.y; break; case ALIGNMENT.RIGHT_BOTTOM: y = (viewableAreaActual.y * -0.5f) - item.BottomRightEdge.y; break; } contentDelta = item.BottomRightEdge.x - item.TopLeftEdge.x + ((addItemSpacing && lastItem != null) ? (itemSpacing) : (0)); } else { // Determine the Y-coordinate: if (items.Count > 0) { addItemSpacing = true; // We will be adding itemSpacing lastItem = items[items.Count - 1]; if(direction == DIRECTION.TtoB_LtoR) y = lastItem.transform.localPosition.y + lastItem.BottomRightEdge.y - itemSpacing - item.TopLeftEdge.y; else y = lastItem.transform.localPosition.y - lastItem.BottomRightEdge.y + itemSpacing + item.TopLeftEdge.y; } else { if (spacingAtEnds) addItemSpacing = true; // We will be adding itemSpacing if(direction == DIRECTION.TtoB_LtoR) y = (viewableAreaActual.y * 0.5f) - item.TopLeftEdge.y - ((spacingAtEnds) ? (itemSpacing) : (0)) - extraEndSpacing; else y = (viewableAreaActual.y * -0.5f) - item.BottomRightEdge.y + ((spacingAtEnds) ? (itemSpacing) : (0)) + extraEndSpacing; } // Determine the X-coordinate: switch (alignment) { case ALIGNMENT.CENTER: x = 0; break; case ALIGNMENT.LEFT_TOP: x = (viewableAreaActual.x * -0.5f) - item.TopLeftEdge.x; break; case ALIGNMENT.RIGHT_BOTTOM: x = (viewableAreaActual.x * 0.5f) - item.BottomRightEdge.x; break; } contentDelta = item.TopLeftEdge.y - item.BottomRightEdge.y + ((addItemSpacing && lastItem != null) ? (itemSpacing) : (0)); } // Position the new item: item.transform.localPosition = new Vector3(x, y); item.Index = items.Count; items.Add(item); UpdateContentExtents(contentDelta); ClipItems(); } else { // Else, insert the item in the midst of our list: items.Insert(position, item); PositionItems(); } */ }
/// <summary> /// Removes the specified item. /// Remaining items are repositioned to fill /// the gap. /// The removed item is destroyed if 'destroy' /// is true. Otherwise, it is deactivated. /// </summary> /// <param name="index">Reference to the item to be removed.</param> public void RemoveItem(IUIListObject item, bool destroy) { for(int i=0; i<items.Count; ++i) { if(items[i] == item) { RemoveItem(i, destroy); return; } } }
/// <summary> /// Sets the item at the specified index as the /// currently selected item. /// </summary> /// <param name="index">The zero-based index of the item.</param> public void SetSelectedItem(int index) { if (index < 0 || index >= items.Count) return; IUIListObject item = items[index]; if (selectedItem != null) selectedItem.selected = false; selectedItem = item; item.selected = true; }
/// <summary> /// Scrolls the list to the specified item in the specified /// number of seconds. /// </summary> /// <param name="item">The item to scroll to.</param> /// <param name="scrollTime">The number of seconds the scroll should last.</param> /// <param name="easing">The type of easing to be used for the scroll.</param> public void ScrollToItem(IUIListObject item, float scrollTime, EZAnimation.EASING_TYPE easing) { snappedItem = item; if (newItems.Count != 0) { if (itemsInserted) RepositionItems(); else PositionNewItems(); itemsInserted = false; newItems.Clear(); } if (orientation == ORIENTATION.HORIZONTAL) { if(direction == DIRECTION.TtoB_LtoR) autoScrollPos = Mathf.Clamp01(item.transform.localPosition.x / amtOfPlay); else autoScrollPos = Mathf.Clamp01(-item.transform.localPosition.x / amtOfPlay); } else { if(direction == DIRECTION.TtoB_LtoR) autoScrollPos = Mathf.Clamp01(-item.transform.localPosition.y / amtOfPlay); else autoScrollPos = Mathf.Clamp01(item.transform.localPosition.y / amtOfPlay); } autoScrollInterpolator = EZAnimation.GetInterpolator(easing); autoScrollStart = scrollPos; autoScrollDelta = autoScrollPos - scrollPos; autoScrollDuration = scrollTime; autoScrollTime = 0; autoScrolling = true; // Do some state cleanup: scrollDelta = 0; isScrolling = false; if (itemSnappedDel != null) itemSnappedDel(snappedItem); }
/// <summary> /// Adds an item to the end of the list. /// NOTE: For proper appearance, list items should each /// be of uniform width when the list is vertical, and of /// uniform height when the list is horizontal. Besides /// that, list items can vary in size. /// </summary> /// <param name="item">Reference to the list item to be added.</param> public void AddItem(IUIListObject item) { AddItem(item, null); }
/// <summary> /// Inserts a list item at the specified position in the list. /// </summary> /// <param name="item">Reference to the item to be inserted into the list.</param> /// <param name="position">0-based index of the position in the list where the item will be placed.</param> public void InsertItem(IUIListObject item, int position) { InsertItem(item, position, null); }
/// <summary> /// Adds an item to the end of the list. /// NOTE: For proper appearance, list items should each /// be of uniform width when the list is vertical, and of /// uniform height when the list is horizontal. Besides /// that, list items can vary in size. /// </summary> /// <param name="item">Reference to the list item to be added.</param> /// <param name="text">Text to display in the item (requires that the item has a TextMesh associated with it, preferably in a child GameObject).</param> public void AddItem(IUIListObject item, string text) { InsertItem(item, items.Count, text); }
/// <summary> /// Empties the contents of the list entirely. /// Destroys the items if instructed, otherwise /// it just deactivates them. /// </summary> /// <param name="destroy">When true, the list items are actually destroyed. Otherwise, they are deactivated.</param> public void ClearList(bool destroy) { RemoveItemsFromContainer(); selectedItem = null; lastClickedControl = null; for (int i = 0; i < items.Count; ++i) { // Move them out of the mover object // and into the root of the scene // hierarchy: items[i].transform.parent = null; #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 items[i].gameObject.SetActive(false); #else items[i].gameObject.SetActiveRecursively(false); #endif if (destroy) { clearQueue.Enqueue(items[i]); } } if (destroy) StartCoroutine("ProcessClearQueue"); visibleItems.Clear(); items.Clear(); PositionItems(); }
private void OnSnapped(IUIListObject item) { if(currentItemNum != ((UIProject)item).Index) currentItemNum = ((UIProject)item).Index; OnControlsChange(); }
private void UpdateSolListCheck(NkSoldierInfo kSolInfo, bool bClickSoldier) { if (!kSolInfo.IsValid()) { return; } if (SolComposeMainDlg.Instance == null || SolComposeMainDlg.Instance.ContainBaseSoldier(kSolInfo.GetSolID())) { return; } string text = string.Empty; int i = 0; while (i < this.ComposeNewListBox.Count) { IUIListObject item = this.ComposeNewListBox.GetItem(i); NkSoldierInfo nkSoldierInfo = (NkSoldierInfo)item.Data; if (nkSoldierInfo.GetSolID() != kSolInfo.GetSolID()) { i++; } else { NewListItem newListItem = new NewListItem(this.ComposeNewListBox.ColumnNum, true, string.Empty); if (newListItem == null) { return; } EVENT_HERODATA eventHeroCharCode = NrTSingleton <NrTableEvnetHeroManager> .Instance.GetEventHeroCharCode(kSolInfo.GetCharKind(), kSolInfo.GetGrade()); if (eventHeroCharCode != null) { newListItem.EventMark = true; newListItem.SetListItemData(3, "Win_I_EventSol", null, null, null); } else { UIBaseInfoLoader legendFrame = NrTSingleton <NrCharKindInfoManager> .Instance.GetLegendFrame(kSolInfo.GetCharKind(), (int)kSolInfo.GetGrade()); if (legendFrame != null) { newListItem.SetListItemData(3, legendFrame, null, null, null); } } newListItem.SetListItemData(4, kSolInfo.GetListSolInfo(false), null, null, null); string legendName = NrTSingleton <NrCharKindInfoManager> .Instance.GetLegendName(kSolInfo.GetCharKind(), (int)kSolInfo.GetGrade(), kSolInfo.GetName()); newListItem.SetListItemData(5, legendName, null, null, null); long num = kSolInfo.GetExp() - kSolInfo.GetCurBaseExp(); long num2 = kSolInfo.GetNextExp() - kSolInfo.GetCurBaseExp(); float num3 = 1f; if (!kSolInfo.IsMaxLevel()) { num3 = ((float)num2 - (float)kSolInfo.GetRemainExp()) / (float)num2; if (num3 > 1f) { num3 = 1f; } if (0f > num3) { num3 = 0f; } } NrTSingleton <CTextParser> .Instance.ReplaceParam(ref text, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("167"), "count1", kSolInfo.GetLevel().ToString(), "count2", kSolInfo.GetSolMaxLevel().ToString() }); newListItem.SetListItemData(6, text, null, null, null); newListItem.SetListItemData(0, "Win_T_ReputelPrgBG", null, null, null); newListItem.SetListItemData(1, "Com_T_GauWaPr4", 270f * num3, null, null); if (kSolInfo.IsMaxLevel()) { text = NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("286"); } else { NrTSingleton <CTextParser> .Instance.ReplaceParam(ref text, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1871"), "exp", num.ToString(), "maxexp", num2.ToString() }); } newListItem.SetListItemData(2, text, null, null, null); if (bClickSoldier) { newListItem.SetListItemData(7, true); newListItem.SetListItemData(7, "Com_I_Check", null, null, null); } else { newListItem.SetListItemData(7, false); newListItem.SetListItemData(7, string.Empty, null, null, null); } if (!kSolInfo.IsAwakening()) { newListItem.SetListItemData(8, false); } if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.SOLCOMPOSE_MAIN_CHALLENGEQUEST_DLG) == null) { newListItem.SetListItemData(9, string.Empty, null, new EZValueChangedDelegate(this.ClickSolDetailInfo), null); } else { newListItem.SetListItemData(9, false); } if (kSolInfo.IsAtbCommonFlag(1L)) { newListItem.SetListItemData(10, true); } else { newListItem.SetListItemData(10, false); } newListItem.Data = kSolInfo; this.ComposeNewListBox.UpdateContents(i, newListItem); break; } } }
// Called by a list button when it is clicked public void DidClick(IUIListObject item) { if (scriptWithMethodToInvoke != null) scriptWithMethodToInvoke.Invoke(methodToInvokeOnSelect, 0); if (changeDelegate != null) changeDelegate(this); }