private void OnEnable() { UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle; UIManager.Instance.KeyPressHandle += Instance_KeyPressHandle; GameState.Instance.Registor <IPlayerState>(IPlayerStateChanged); iPlayerStateRun = GameState.Instance.GetEntity <IPlayerState>(); playerState = DataCenter.Instance.GetEntity <PlayerState>(); //读取数据并初始化控件 //给List控件重新填充数据 uiDepostiList.Init(); PlayGoods[] playGoodsArray = playerState.PlayerAllGoods.Where(temp => temp.GoodsLocation == GoodsLocation.Package).ToArray();//玩家所有包括中的物品 foreach (PlayGoods playGoods in playGoodsArray) { UIListItem uiListItem = uiDepostiList.NewItem(); uiListItem.childText.text = playGoods.GoodsInfo.GoodsName + " X" + playGoods.Count; uiListItem.value = playGoods; } uiDepostiList.UpdateUI(); focusUIListItem = uiDepostiList.GetAllImtes().FirstOrDefault(); if (focusUIListItem) { if (focusUIListItem.childImage) { focusUIListItem.childImage.enabled = true; } } }
private void MegListItemSelectEvent(UIListItem item) { if (item == this.m_BackupSelectItem) { return; } if (null != this.m_BackupSelectItem) { this.m_BackupSelectItem.CancelSelect(); } this.m_BackupSelectItem = item; if (MessageData.ActiveMsgDataIDs.Contains(item.ID)) { MessageData info = MessageData.AllMsgDataDic[item.ID]; this.UpdateForm(info.Form); this.UpdateTo(info.To); this.UpdateTopic(info.Topic); this.UpdateContent(info.Title, info.Content, info.End); this.UpdateDate(info.Date); } else { this.ResetAllLabel(); } }
/// <summary> /// 设置焦点 /// 已经在OnEnable处理过第一个焦点获取了,此时不需要重设 /// </summary> public override void SetForcus() { focused = true; //如果当前没有选择焦点的选项则设置一个 if (!focusUIListItem && uiDepostiList) { focusUIListItem = uiDepostiList.FirstShowItem(); } if (focusUIListItem && uiDepostiList) { uiDepostiList.ShowItem(focusUIListItem); if (focusUIListItem.childImage) { focusUIListItem.childImage.enabled = true; } //设置选择了该物体 PlayGoods playGoods = (PlayGoods)focusUIListItem.value; if (SelectGoodsIDAction != null) { SelectGoodsIDAction(playGoods.ID); } } else//否则就没有选择 { if (SelectGoodsIDAction != null) { SelectGoodsIDAction(-1); } } }
public override void Copy(SpriteRoot s, ControlCopyFlags flags) { base.Copy(s, flags); if (!(s is UIListItem)) { return; } UIListItem b = (UIListItem)s; if ((flags & ControlCopyFlags.Settings) == ControlCopyFlags.Settings) { list = b.list; } if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance) { topLeftEdge = b.topLeftEdge; bottomRightEdge = b.bottomRightEdge; colliderTL = b.colliderTL; colliderBR = b.colliderBR; colliderCenter = b.colliderCenter; customCollider = b.customCollider; } }
/// <summary> /// 点击条目事件 /// </summary> /// <param name="e"></param> private void ItemMouseUp(BaseEventData e) { if (!CanClickListItem) { return; } PointerEventData pe = e as PointerEventData; if (ItemClickHandle != null) { if (pe.pointerCurrentRaycast.gameObject != null) { UIListItem currentItem = UITools.FindTargetPopup <UIListItem>(pe.pointerCurrentRaycast.gameObject.transform); if (currentItem) { switch (pe.button) { case PointerEventData.InputButton.Left: ItemClickHandle(ItemClickMouseType.Left, currentItem); break; case PointerEventData.InputButton.Right: ItemClickHandle(ItemClickMouseType.Right, currentItem); break; case PointerEventData.InputButton.Middle: ItemClickHandle(ItemClickMouseType.Middle, currentItem); break; } } } } }
//===================================================================== // // Methods - UIDraggablePanel2 // //===================================================================== /// <summary> /// 꼬리부분을 머리부분으로 옮긴다. /// </summary> public void TailToHead() { int cnt = Arrangement == EArrangement.Vertical ? maxCol : maxRow; for (int i = 0; i < cnt; i++) { UIListItem item = Tail; if (item == null) { return; } if (item == Head) { return; } if (item.Prev != null) { item.Prev.Next = null; } item.Next = Head; item.Prev = null; Head.Prev = item; mList.RemoveAt(mList.Count - 1); mList.Insert(0, item); item.MoveToHead(); } }
/// <summary> /// 显示指定的条目 /// </summary> /// <param name="target"></param> public void ShowItem(UIListItem target) { if (!target) { return; } int index = itemsList.IndexOf(target.gameObject); if (index < 0) { return; } float showUp = Mathf.Abs(showRect.offsetMax.y); float showDown = showUp + backRect.rect.height; float itemUp = Mathf.Abs(index * itemHeight); float itemDown = itemUp + itemHeight; //判断当前条目实在显示面板的上面还是下面 if (showUp > itemUp)//条目在显示区域上方,需要向上移动(负数) { if (scrollMoveRate > 0) { MoveScroll((itemUp - showUp) / scrollMoveRate); } } else if (showDown < itemDown)//条目在显示区域下方,需要向下移动(正数) { if (scrollMoveRate > 0) { MoveScroll((itemDown - showDown) / scrollMoveRate); } } }
/// <summary> /// 移除物品的显示 /// </summary> /// <param name="playGoods"></param> protected virtual void RemoveItemShow(PlayGoods playGoods) { UIListItem[] uiListItems = ItemUIList.GetAllImtes(); UIListItem thisUIListItem = uiListItems.FirstOrDefault(temp => { PlayGoods thisPlayGoods = temp.value as PlayGoods; if (thisPlayGoods != null && thisPlayGoods == playGoods) { return(true); } return(false); }); if (thisUIListItem != null) { ItemUIList.RemoveItem(thisUIListItem); ItemUIList.UpdateUI(); SelectGoods = ItemUIList.FirstShowItem(); if (SelectGoods != null) { ItemUIList.ShowItem(SelectGoods); SelectGoods.childImage.enabled = true; SelectGoods.childImage.gameObject.SetActive(true); } } }
void InitContestItem(UIListItem item, int index) { item.Target.gameObject.transform.FindChild("Button").GetComponent <ItemContestsBtns>() .SetContestSeq(mContestList[index]); if (Localization.language.Equals("English")) { item.Target.gameObject.transform.FindChild("LblTitle") .GetComponent <UILabel>().text = mContestList[index].contestName; } else { item.Target.gameObject.transform.FindChild("LblTitle") .GetComponent <UILabel>().text = mContestList[index].contestNameKor; } item.Target.gameObject.transform.FindChild("LblTotalPrize").FindChild("Label") //enties .GetComponent <UILabel>().text = UtilMgr.AddsThousandsSeparator(mContestList[index].totalReward) + "G"; item.Target.gameObject.transform.FindChild("LblTickets").FindChild("Label") .GetComponent <UILabel>().text = mContestList[index].entryTicket + ""; item.Target.gameObject.transform.FindChild("Lbl1stPrize").FindChild("Label") .GetComponent <UILabel>().text = UtilMgr.AddsThousandsSeparator(mContestList[index].firstRewardGold) + "G"; if (mContestList[index].myEntry > 0) { item.Target.gameObject.transform.FindChild("SprJoin").gameObject.SetActive(true); } else { item.Target.gameObject.transform.FindChild("SprJoin").gameObject.SetActive(false); } item.Target.gameObject.transform.FindChild("LblEntries").FindChild("Label") .GetComponent <UILabel>().text = "[333333][b]" + UtilMgr.AddsThousandsSeparator(mContestList[index].totalJoin) + "[/b][-][666666] / " + UtilMgr.AddsThousandsSeparator(mContestList[index].totalEntry); }
private List <UIListItem> CreateAtmosphericCharacteristics(CelestialBody currentBody, GenericCascadingList cascadingList) { GenericCascadingList genericCascadingList = cascadingList; Boolean atmosphere = currentBody.atmosphere && currentBody.atmospherePressureSeaLevel > 0; String key = Localizer.Format("#autoLOC_462448"); String template = atmosphere ? "#autoLOC_439855" : "#autoLOC_439856"; UIListItem item = genericCascadingList.CreateBody(key, "<color=#b8f4d1>" + Localizer.Format((string)template) + "</color>"); List <UIListItem> list = new List <UIListItem>(); list.Add(item); if (atmosphere) { item = cascadingList.CreateBody(Localizer.Format("#autoLOC_462453"), "<color=#b8f4d1>" + KSPUtil.LocalizeNumber(currentBody.atmosphereDepth, "N0") + " " + Localizer.Format("#autoLOC_7001411") + "</color>"); list.Add(item); item = cascadingList.CreateBody(Localizer.Format("#autoLOC_462456"), "<color=#b8f4d1>" + KSPUtil.LocalizeNumber(currentBody.atmospherePressureSeaLevel / 101.324996948242, "0.#####") + " " + Localizer.Format("#autoLOC_7001419") + "</color>"); list.Add(item); item = cascadingList.CreateBody(Localizer.Format("#autoLOC_462459"), "<color=#b8f4d1>" + KSPUtil.LocalizeNumber(currentBody.atmosphereTemperatureSeaLevel, "0.##") + " " + Localizer.Format("#autoLOC_7001406") + "</color>"); list.Add(item); } return(list); }
/// <summary> /// 머리 부분을 꼬리 부분으로 옮긴다. /// </summary> public void HeadToTail() { int cnt = Arrangement == EArrangement.Vertical ? maxCol : maxRow; for (int i = 0; i < cnt; i++) { UIListItem item = Head; if (item == null) { return; } if (item == Tail) { return; } item.Next.Prev = null; item.Next = null; item.Prev = Tail; Tail.Next = item; mList.RemoveAt(0); mList.Insert(mList.Count, item); item.MoveToTail(); } }
/// <summary> /// Return value positive means left > right, return value negative means left < right /// </summary> /// <param name="left"></param> /// <param name="right"></param> /// <returns></returns> static int UIList_Cmp(UIListItem left, UIListItem right) { CrewListItem ldata = null; CrewListItem rdata = null; try { ldata = left.GetComponent <CrewListItem>(); } catch { return(1); } try { rdata = right.GetComponent <CrewListItem>(); } catch { return(-1); } #if DEBUG if (ldata == null) { return(1); } if (rdata == null) { return(-1); } #endif bool ltourist = ldata.GetCrewRef().type == ProtoCrewMember.KerbalType.Tourist; bool rtourist = rdata.GetCrewRef().type == ProtoCrewMember.KerbalType.Tourist; if (ltourist && !rtourist) { return(1); } // tourists are also sorted to the end if (!ltourist && rtourist) { return(-1); } // tourists are also sorted to the end return(ldata.GetName().CompareTo(rdata.GetName())); }
void InitContestItem(UIListItem item, int index) { item.Target.gameObject.transform.FindChild("Button").GetComponent<ItemContestsBtns>() .SetContestSeq(mContestList[index]); if(Localization.language.Equals("English")){ item.Target.gameObject.transform.FindChild("LblTitle") .GetComponent<UILabel>().text = mContestList[index].contestName; } else{ item.Target.gameObject.transform.FindChild("LblTitle") .GetComponent<UILabel>().text = mContestList[index].contestNameKor; } item.Target.gameObject.transform.FindChild("LblTotalPrize").FindChild("Label")//enties .GetComponent<UILabel>().text = UtilMgr.AddsThousandsSeparator(mContestList[index].totalReward)+"G"; item.Target.gameObject.transform.FindChild("LblTickets").FindChild("Label") .GetComponent<UILabel>().text = mContestList[index].entryTicket+""; item.Target.gameObject.transform.FindChild("Lbl1stPrize").FindChild("Label") .GetComponent<UILabel>().text = UtilMgr.AddsThousandsSeparator(mContestList[index].firstRewardGold)+"G"; if(mContestList[index].myEntry > 0) item.Target.gameObject.transform.FindChild("SprJoin").gameObject.SetActive(true); else item.Target.gameObject.transform.FindChild("SprJoin").gameObject.SetActive(false); item.Target.gameObject.transform.FindChild("LblEntries").FindChild("Label") .GetComponent<UILabel>().text = "[333333][b]" + UtilMgr.AddsThousandsSeparator(mContestList[index].totalJoin) + "[/b][-][666666] / "+ UtilMgr.AddsThousandsSeparator(mContestList[index].totalEntry); }
/// <summary> /// 移动选择条目 /// </summary> /// <param name="keyType"></param> protected virtual void MoveItemSelect(UIManager.KeyType keyType) { switch (keyType) { case UIManager.KeyType.UP: case UIManager.KeyType.DOWN: UIListItem[] uiListItems = ItemUIList.GetAllImtes(); int index = uiListItems.ToList().IndexOf(SelectGoods); index += keyType == UIManager.KeyType.UP ? -1 : 1; if (index >= uiListItems.Length) { index = uiListItems.Length - 1; } else if (index < 0) { index = 0; } if (index < uiListItems.Length && index >= 0) { UIListItem nextSelectGoods = uiListItems[index]; if (nextSelectGoods != null) { SelectGoods.childImage.enabled = false; SelectGoods.childImage.gameObject.SetActive(false); SelectGoods = nextSelectGoods; SelectGoods.childImage.enabled = true; SelectGoods.childImage.gameObject.SetActive(true); ItemUIList.ShowItem(SelectGoods); ItemUIList.UpdateUI(); } } break; } }
internal MessageItem(UIListItem item, Vector2 cellSize) { this.item = item; rectTransform = item.GetComponent <RectTransform>(); rectTransform.anchoredPosition3D = Vector3.zero; tweens = item.GetComponent <UIPlayTweens>(); rectTransform.sizeDelta = cellSize; }
private void AddNewListItem(int msgID) { UIListItem item = this.GetNewMsgListItem(); item.UpdateInfo(msgID, MessageData.AllMsgDataDic[msgID].Topic); item.SelectEvent = this.MegListItemSelectEvent; this.m_CurListItems.Add(item); }
void initWindow(int cachSize, int showSize, UIListItem prefab) { Debug.LogError("" + cachSize + "," + showSize); mCachSize = cachSize; mShowSize = showSize; mBegin = 0; mCach = new UIListItem[mCachSize]; }
private void AddNewListItem(int msgID) { UIListItem item = this.GetNewMsgListItem(); item.UpdateInfo(msgID, MonsterHandbookData.AllMonsterHandbookDataDic[msgID].Name); item.SelectEvent = this.MhListItemSelectEvent; this.m_CurListItems.Add(item); }
private void ResetWnd() { this.m_OpCameraStep = 0; this.m_CurMonsterGo = null; this.m_CurMonsterID = -1; this.m_ListScrollBar.scrollValue = 0; this.m_DescriptionScrollBar.scrollValue = 0; this.m_BackupSelectItem = null; this.ResetAllLabel(); }
public override void Show() { base.Show(); RadioManager.Instance.RefreshSoundsList(); LoadSoundsList(); m_BackupSelectItem = null; UpdateSelectItem(); RadioManager.Instance.UpdateSelectItemEvent += UpdateSelectItem; RadioManager.Instance.PlayErrorEvent += PlayErrorEvent; }
protected override void Render(Fact item, UIListItem listItem) { var t = Instantiate <UIFactItem> (UIFactItemPrefab, listItem.transform); (listItem.transform as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 50); t.Fact = item; listItem.GetComponent <Button> ().onClick.AddListener(() => { UIBrain.instance.AddItem(t); }); }
static int UIList_Partition(UIList list, int li, int ri) { // Select a random pivot point int pi = UnityEngine.Random.Range(li + 1, ri + 1); UIListItem pivot = list.GetUilistItemAt(pi); #if DEBUG print("Selected pivot is " + pivot.GetComponent <CrewListItem>().GetName() + " at pos " + pi.ToString()); #endif if (pi < ri) { // Move the pivot to the very end list.SwapItems(pivot, list.GetUilistItemAt(ri)); pi = ri; } UIList_DebugPrint(list, li, ri, "Pivot-selection"); // Iterate over the list and sort above or below pivot as we go int i = li; UIListItem prev = list.GetUilistItemAt(i); for (int j = li; j < ri; j++) { UIListItem selected = list.GetUilistItemAt(j); if (UIList_Cmp(selected, pivot) < 1) { #if DEBUG print("Pivotname is " + pivot.GetComponent <CrewListItem>().GetName() + " selname is " + selected.GetComponent <CrewListItem>().GetName()); UIList_DebugPrint(list, i, j, "Partition-swapping (" + i.ToString() + "," + j.ToString() + "," + UIList_Cmp(selected, pivot) + ")"); #endif if (i < j) { list.SwapItems(prev, selected); } UIList_DebugPrint(list, li, ri, "Afterswap i=" + i.ToString()); i++; prev = list.GetUilistItemAt(i); } } UIListItem pivot_target = list.GetUilistItemAt(i); if (UIList_Cmp(pivot_target, pivot) >= 0) { UIList_DebugPrint(list, li, ri, "Finalswap i=" + i.ToString()); list.SwapItems(list.GetUilistItemAt(i), pivot); UIList_DebugPrint(list, li, ri, "Finalswap done i=" + i.ToString()); return(i); } else { return(ri); } }
/// <summary> /// 点击条目事件(将会重新设置选择项) /// </summary> /// <param name="arg1"></param> /// <param name="arg2"></param> protected virtual void ItemUIList_ItemClickHandle(UIList.ItemClickMouseType arg1, UIListItem arg2) { //设置当前的选择 SelectGoods.childImage.enabled = false; SelectGoods.childImage.gameObject.SetActive(false); SelectGoods = arg2; SelectGoods.childImage.enabled = true; SelectGoods.childImage.gameObject.SetActive(true); ItemUIList.ShowItem(SelectGoods); ItemUIList.UpdateUI(); }
//**************************************************************************************************** // //**************************************************************************************************** public UIListItem this[int index] { get { UIListItem item = null; dic.TryGetValue(index, out item); return(item); } }
//**************************************************************************************************** // //**************************************************************************************************** private void SelectItem(int index) { UIListItem item = (index >= 0) ? this[index] : null; UIListItemData data = (item != null) ? item.datas : null; if (data != null) { SelectItemUserDatas(data.userDatas); } }
/// <summary> /// 아이템을 생성한다. /// </summary> /// <param name="count"></param> /// <param name="callback"></param> public void Init(int count, ChangeIndexDelegate callback) { mCallback = callback; ItemCount = count; SetTemplate(count); RemoveAll(); mList.Clear(); //화면에 보여질 개수 if (Arrangement == EArrangement.Vertical) { mMinShowCount = maxCol * (maxRow + 1); } else { mMinShowCount = (maxCol + 1) * maxRow; } int makeCount = Mathf.Min(count, mMinShowCount); GameObject obj = null; UIListItem prevItem = null; //Debug.Log ("makecout : " + makeCount); for (int i = 0; i < makeCount; i++) { // Debug.Log(gameObject+ " : " + TemplatePrefab ); obj = NGUITools.AddChild(gameObject, TemplatePrefab); if (obj.GetComponent <UIDragScrollView>() == null) { obj.AddComponent <UIDragScrollView>().scrollView = this; } UIListItem item = new UIListItem(); item.Target = obj; //item.Target.AddComponent<cUIScrollListBase>(); item.SetIndex(i); mList.Add(item); item.Prev = prevItem; item.Next = null; if (prevItem != null) { prevItem.Next = item; } prevItem = item; mCallback(item, i); } UpdatePosition(); }
public override void DrawPrestateSettings() { base.DrawPrestateSettings(); BeginMonitorChanges(); UIListItem li = (UIListItem)control; li.activeOnlyWhenSelected = EditorGUILayout.Toggle("Active Only When Selected", li.activeOnlyWhenSelected); EndMonitorChanges(); }
/// <summary> /// 아이템 모두 삭제한다. /// </summary> public void RemoveAll() { UIListItem item = null; for (int i = 0; i < mList.Count; i++) { item = mList[i]; GameObject.DestroyImmediate(item.Target); } mList.Clear(); }
/// <summary> /// 移除指定的条目 /// </summary> /// <param name="target"></param> /// <returns></returns> public bool RemoveItem(UIListItem target) { int removeCount = itemsList.RemoveAll(temp => object.Equals(temp.GetComponent <UIListItem>(), target)); if (removeCount > 0) { GameObject.Destroy(target.gameObject); UpdateUI(); return(true); } return(false); }
/// <summary> /// 移动子焦点(list中的数据,这里不用焦点) /// </summary> /// <param name="moveType"></param> public override void MoveChild(UIFocusPath.MoveType moveType) { if (focusUIListItem == null) { focusUIListItem = uiDepostiList.FirstShowItem(); } UIListItem[] tempArrays = uiDepostiList.GetAllImtes(); if (tempArrays.Length == 0) { return; } int index = 0; if (focusUIListItem) { index = tempArrays.ToList().IndexOf(focusUIListItem); } if (index < 0) { index = 0; } switch (moveType) { case UIFocusPath.MoveType.UP: //- index--; break; case UIFocusPath.MoveType.DOWN: //+ index++; break; } index = Mathf.Clamp(index, 0, tempArrays.Length - 1); if (index < tempArrays.Length) { uiDepostiList.ShowItem(tempArrays[index]); if (focusUIListItem && focusUIListItem.childImage) { focusUIListItem.childImage.enabled = false; } focusUIListItem = tempArrays[index]; if (focusUIListItem && focusUIListItem.childImage) { focusUIListItem.childImage.enabled = true; } //设置选择了该物体 PlayGoods playGoods = (PlayGoods)focusUIListItem.value; if (SelectGoodsIDAction != null) { SelectGoodsIDAction(playGoods.ID); } } }
void InitItem(UIListItem item, int index) { LineupInfo info = mLineupEvent.Response.data[index]; item.Target.GetComponent<ItemLineup>().mLineupInfo = info; item.Target.transform.FindChild("Normal").FindChild("LblName").GetComponent<UILabel>().text = info.name; int width = item.Target.transform.FindChild("Normal").FindChild("LblName").GetComponent<UILabel>().width; item.Target.transform.FindChild("Normal").FindChild("LblName").FindChild("BtnEdit"). localPosition = new Vector3(width+40f, 0); item.Target.transform.FindChild("Delete").FindChild("LblName").GetComponent<UILabel>().text = info.name; item.Target.transform.FindChild("Normal").FindChild("LblValue").GetComponent<UILabel>().text = info.entryPlayers; item.Target.transform.FindChild("Delete").FindChild("LblValue").GetComponent<UILabel>().text = info.entryPlayers; }
/// <summary> /// 按键检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { Action <int> MoveListAction = (addOffset) => { UIListItem[] tempArrays = uiTaskList.GetAllImtes(); if (tempArrays.Length == 0) { return; } int index = 0; if (nowTaskItem) { index = tempArrays.ToList().IndexOf(nowTaskItem); } if (index < 0) { index = 0; } index += addOffset; index = Mathf.Clamp(index, 0, tempArrays.Length - 1); if (index < tempArrays.Length) { uiTaskList.ShowItem(tempArrays[index]); if (nowTaskItem && nowTaskItem.childImage) { nowTaskItem.childImage.enabled = false; } nowTaskItem = tempArrays[index]; if (nowTaskItem && nowTaskItem.childImage) { nowTaskItem.childImage.enabled = true; } ExplanNowItem(); } }; switch (keyType) { case UIManager.KeyType.Y: //任务追踪 MarkTaskToMap(); break; case UIManager.KeyType.UP: MoveListAction(-1); break; case UIManager.KeyType.DOWN: MoveListAction(1); break; } }
private void ActivateChatList( eCHATTYPE type, UIListItem chatItem, bool isMe) { if( CHAT_FILTER_TYPE.General != filterType) { if( CHAT_FILTER_TYPE.None != filterType) { switch( type) { case eCHATTYPE.eCHATTYPE_PUBLIC: case eCHATTYPE.eCHATTYPE_MAP: case eCHATTYPE.eCHATTYPE_SERVER: chatItem.gameObject.SetActiveRecursively( false); break; default: break; } } } else { if( false == isMe) { switch( type) { case eCHATTYPE.eCHATTYPE_PUBLIC: case eCHATTYPE.eCHATTYPE_MAP: case eCHATTYPE.eCHATTYPE_SERVER: break; } } else { switch( type) { case eCHATTYPE.eCHATTYPE_PUBLIC: case eCHATTYPE.eCHATTYPE_MAP: case eCHATTYPE.eCHATTYPE_SERVER: break; } } } }
void InitItem(UIListItem item, int index) { PlayerInfo info = mPlayerList[index]; if(info.IsCard){ item.Target.transform.FindChild("Main").gameObject.SetActive(false); item.Target.transform.FindChild("Sub").gameObject.SetActive(true); Transform tf = item.Target.transform.FindChild("Sub"); Debug.Log("korname is "+info.korName); tf.GetComponent<ItemSelectPlayerSub>().mPlayerInfo = info; tf.FindChild("LblSalaryB").GetComponent<UILabel>().text = "[s]$ "+UtilMgr.AddsThousandsSeparator(info.salary_org+""); tf.FindChild("LblSalary").GetComponent<UILabel>().text = "$ "+UtilMgr.AddsThousandsSeparator(info.salary+""); tf.FindChild("Level").FindChild("LblLV").FindChild("Label").GetComponent<UILabel>().text = info.level+""; tf.FindChild("LblSkill").FindChild("Label").GetComponent<UILabel>().text = "1"; tf.FindChild("SprPhoto").GetComponent<UISprite>().spriteName = "starcard_" + info.grade; for(int i = 0; i < 6; i++){ tf.FindChild("Level").FindChild("Star"+(i+1)).GetComponent<UISprite>() .color = new Color(102f/255f, 102f/255f, 102f/255f); } for(int i = 0; i <info.grade; i++){ tf.FindChild("Level").FindChild("Star"+(i+1)).GetComponent<UISprite>() .color = new Color(252f/255f, 133f/255f, 53f/255f); } } else{ item.Target.transform.FindChild("Main").gameObject.SetActive(true); item.Target.transform.FindChild("Sub").gameObject.SetActive(false); Transform tf = item.Target.transform.FindChild("Main"); tf.GetComponent<ItemSelectPlayerMain>().mPlayerInfo = info; tf.FindChild("LblPosition").GetComponent<UILabel>().text = info.position; if(Localization.language.Equals("English")){ tf.FindChild("LblName").GetComponent<UILabel>().text = info.firstName + " " + info.lastName; if(tf.FindChild("LblName").GetComponent<UILabel>().width > 232) tf.FindChild("LblName").GetComponent<UILabel>().text = info.firstName.Substring(0, 1) + ". " +info.lastName; tf.FindChild("LblTeam").GetComponent<UILabel>().text = info.city + " " + info.teamName; } else{ tf.FindChild("LblName").GetComponent<UILabel>().text = info.korName; tf.FindChild("LblTeam").GetComponent<UILabel>().text = info.korTeamName; } tf.FindChild("LblFPPG").FindChild("LblFPPGV").GetComponent<UILabel>().text = string.Format("{0:F1}", info.fppg); tf.FindChild("LblPlayed").FindChild("LblPlayedV").GetComponent<UILabel>().text = info.games+""; // tf.FindChild("LblYear").GetComponent<UILabel>().gameObject.SetActive(false); tf.FindChild("LblSalary").GetComponent<UILabel>().text = "$ "+UtilMgr.AddsThousandsSeparator(info.salary); item.Target.transform.FindChild("Main").FindChild("MLB").gameObject.SetActive(false); item.Target.transform.FindChild("Main").FindChild("KBO").gameObject.SetActive(true); tf = item.Target.transform.FindChild("Main").FindChild("KBO"); if((info.injuryYN != null) && (info.injuryYN.Equals("Y"))) tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("SprInjury").gameObject.SetActive(true); else tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("SprInjury").gameObject.SetActive(false); TeamScheduleInfo schedule = null; foreach(TeamScheduleInfo team in UserMgr.ScheduleList){ if(info.team == team.awayTeamId || info.team == team.homeTeamId){ if(team.dateTime.Equals( transform.root.FindChild("RegisterEntry").GetComponent<RegisterEntry>().mContestInfo.startTime)){ schedule = team; break; } } } if(schedule != null){ item.Target.transform.FindChild("Main").FindChild("LblYear").GetComponent<UILabel>().text = schedule.awayTeam + " @ " + schedule.homeTeam; } else item.Target.transform.FindChild("Main").FindChild("LblYear").gameObject.SetActive(false); tf.FindChild("BtnPhoto") .FindChild("Panel").FindChild("TxtPlayer").GetComponent<UITexture>().mainTexture = UtilMgr.GetTextureDefault(); tf.FindChild("BtnPhoto") .FindChild("Panel").FindChild("TxtPlayer").GetComponent<UITexture>().color = new Color(1f, 1f, 1f, 50f/255f); UtilMgr.LoadImage(info.playerId , tf.FindChild("BtnPhoto") .FindChild("Panel").FindChild("TxtPlayer").GetComponent<UITexture>()); } }
private void ActivateChatList( eCHATTYPE type, UIListItem chatItem, bool isMe) { if( CHAT_FILTER_TYPE.General != filterType) { if( CHAT_FILTER_TYPE.None != filterType) { switch( type) { case eCHATTYPE.eCHATTYPE_PUBLIC: case eCHATTYPE.eCHATTYPE_MAP: case eCHATTYPE.eCHATTYPE_SERVER: chatItem.gameObject.SetActiveRecursively( false); break; default: StartModifyTransparency(); break; } } else StartModifyTransparency(); } else { if( false == isMe) { switch( type) { case eCHATTYPE.eCHATTYPE_PUBLIC: case eCHATTYPE.eCHATTYPE_MAP: case eCHATTYPE.eCHATTYPE_SERVER: chatItem.spriteText.Color = new Color( 1.0f, 1.0f, 1.0f, bgColor.a); break; } } else { switch( type) { case eCHATTYPE.eCHATTYPE_PUBLIC: case eCHATTYPE.eCHATTYPE_MAP: case eCHATTYPE.eCHATTYPE_SERVER: StartModifyTransparency(); break; } } } }
void InitInvenItem(UIListItem item, int index) { CardInfo info = mSortedList[index]; item.Target.transform.FindChild("ItemCard").FindChild("BtnRight").GetComponent<BtnSelectFeeding>().mCardInfo = info; item.Target.transform.FindChild("ItemCard").FindChild("BtnRight").GetComponent<BtnSelectFeeding>().IsSelected = false; if(transform.root.FindChild("CardPowerUp").GetComponent<CardPowerUp>().mCardFeedList != null) foreach(CardInfo feedInfo in transform.root.FindChild("CardPowerUp").GetComponent<CardPowerUp>().mCardFeedList){ if(feedInfo.itemSeq == info.itemSeq){ item.Target.transform.FindChild("ItemCard").FindChild("BtnRight").GetComponent<BtnSelectFeeding>().IsSelected = true; break; } } Transform tf = item.Target.transform.FindChild("ItemCard"); if(Localization.language.Equals("English")){ tf.FindChild("LblName").GetComponent<UILabel>().text = info.firstName + " " + info.lastName; if(tf.FindChild("LblName").GetComponent<UILabel>().width > 232) tf.FindChild("LblName").GetComponent<UILabel>().text = info.firstName.Substring(0, 1) + ". " + info.lastName; tf.FindChild("LblTeam").GetComponent<UILabel>().text = info.city + " " + info.teamName; } else{ tf.FindChild("LblName").GetComponent<UILabel>().text = info.korName; tf.FindChild("LblTeam").GetComponent<UILabel>().text = info.korTeamName; } tf.FindChild("LblPosition").GetComponent<UILabel>().text = info.position; tf.FindChild("LblSalary").GetComponent<UILabel>().text = "$"+info.salary; tf.FindChild("Star").FindChild("StarV").GetComponent<UILabel>().text = info.cardClass+""; tf.FindChild("Star").FindChild("StarV").localPosition = new Vector3(20f + (18f * (info.cardClass -1)), -4f); for(int i = 1; i <= 6; i++) tf.FindChild("Star").FindChild("SprStar"+i).gameObject.SetActive(false); for(int i = 1; i <= info.cardClass; i++){ tf.FindChild("Star").FindChild("SprStar"+i).gameObject.SetActive(true); string starStr = "star_bronze"; if(info.cardClass > 4){ starStr = "star_gold"; } else if(info.cardClass > 2){ starStr = "star_silver"; } tf.FindChild("Star").FindChild("SprStar"+i).GetComponent<UISprite>().spriteName = starStr; } tf.FindChild("Level").localPosition = new Vector3(-124f + (18f * (info.cardClass -1)), -40f); tf.FindChild("Level").FindChild("LblLevel").FindChild("LevelV").GetComponent<UILabel>().text = info.cardLevel+""; tf.FindChild("LblFPPG").FindChild("LblFPPGV").GetComponent<UILabel>().text = info.fppg; tf.FindChild("LblSkill").FindChild("LblSkillV").GetComponent<UILabel>().text = "1"; if(info.useYn > 0){ tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(true); tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion = new Vector4(0, 0, 156f, 130f); } else{ tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(false); tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion = new Vector4(0, 0, 152f, 108f); } if((info.injuryYN != null) && (info.injuryYN.Equals("Y"))){ tf.FindChild("BtnPhoto").FindChild("SprInjury").gameObject.SetActive(true); } else tf.FindChild("BtnPhoto").FindChild("SprInjury").gameObject.SetActive(false); tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Texture").GetComponent<UITexture>().mainTexture = UtilMgr.GetTextureDefault(); tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Texture").GetComponent<UITexture>().color = new Color(1f, 1f, 1f, 50f/255f); UtilMgr.LoadImage(info.playerFK, tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Texture").GetComponent<UITexture>()); }
void InitInvenItem(UIListItem item, int index) { CardInfo info = mList[index]; item.Target.GetComponent<ItemInvenCard>().mCardInfo = info; if(info.mType == CardInfo.INVEN_TYPE.CARD){ item.Target.transform.FindChild("ItemCardPack").gameObject.SetActive(false); item.Target.transform.FindChild("ItemCard").gameObject.SetActive(true); item.Target.transform.FindChild("ItemExpand").gameObject.SetActive(false); Transform tf = item.Target.transform.FindChild("ItemCard"); tf.GetComponent<ItemCard>().mCardInfo = info; tf.FindChild("LblPosition").GetComponent<UILabel>().text = info.position; if(Localization.language.Equals("English")){ tf.FindChild("LblName").GetComponent<UILabel>().text = info.firstName + " " + info.lastName; if(tf.FindChild("LblName").GetComponent<UILabel>().width > 232) tf.FindChild("LblName").GetComponent<UILabel>().text = info.firstName.Substring(0, 1) + ". " +info.lastName; if(info.teamName.Length < 1){ tf.FindChild("LblTeam").GetComponent<UILabel>().text = UtilMgr.GetLocalText("StrInactive"); } else tf.FindChild("LblTeam").GetComponent<UILabel>().text = info.city + " " + info.teamName; } else{ tf.FindChild("LblName").GetComponent<UILabel>().text = info.korName; if(info.teamName.Length < 1){ tf.FindChild("LblTeam").GetComponent<UILabel>().text = UtilMgr.GetLocalText("StrInactive"); } else tf.FindChild("LblTeam").GetComponent<UILabel>().text = info.korTeamName; } tf.FindChild("LblSalary").GetComponent<UILabel>().text = "$"+info.salary; tf.FindChild("Star").FindChild("StarV").GetComponent<UILabel>().text = info.cardClass+""; tf.FindChild("Star").FindChild("StarV").localPosition = new Vector3(20f + (18f * (info.cardClass -1)), -4f); for(int i = 1; i <= 6; i++) tf.FindChild("Star").FindChild("SprStar"+i).gameObject.SetActive(false); for(int i = 1; i <= info.cardClass; i++){ tf.FindChild("Star").FindChild("SprStar"+i).gameObject.SetActive(true); string starStr = "star_bronze"; if(info.cardClass > 4){ starStr = "star_gold"; } else if(info.cardClass > 2){ starStr = "star_silver"; } tf.FindChild("Star").FindChild("SprStar"+i).GetComponent<UISprite>().spriteName = starStr; } tf.FindChild("Level").localPosition = new Vector3(-124f + (18f * (info.cardClass -1)), -40f); tf.FindChild("Level").FindChild("LblLevel").FindChild("LevelV").GetComponent<UILabel>().text = info.cardLevel+""; tf.FindChild("LblFPPG").FindChild("LblFPPGV").GetComponent<UILabel>().text = info.fppg; tf.FindChild("LblSkill").FindChild("LblSkillV").GetComponent<UILabel>().text = "1"; // if(UtilMgr.IsMLB()){ // tf.FindChild("MLB").gameObject.SetActive(true); // tf.FindChild("KBO").gameObject.SetActive(false); // // tf = item.Target.transform.FindChild("ItemCard").FindChild("MLB"); // // if((info.injuryYN != null) && (info.injuryYN.Equals("Y"))){ // tf.FindChild("BtnPhoto").FindChild("SprInjury").gameObject.SetActive(true); // } else // tf.FindChild("BtnPhoto").FindChild("SprInjury").gameObject.SetActive(false); // // if(info.useYn > 0){ // tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(true); // tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion // = new Vector4(0, 0, 156f, 130f); // } else{ // tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(false); // tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion // = new Vector4(0, 0, 152f, 108f); // } // } else{ tf.FindChild("MLB").gameObject.SetActive(false); tf.FindChild("KBO").gameObject.SetActive(true); tf = item.Target.transform.FindChild("ItemCard").FindChild("KBO"); if((info.injuryYN != null) && (info.injuryYN.Equals("Y"))){ tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("SprInjury").gameObject.SetActive(true); } else tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("SprInjury").gameObject.SetActive(false); tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(false); tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion = new Vector4(0, 0, 152f, 186f); if(info.useYn > 0){ tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(true); tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion = new Vector4(0, 0, 156f, 130f); } else{ tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Inuse").gameObject.SetActive(false); tf.FindChild("BtnPhoto").FindChild("Panel").GetComponent<UIPanel>().baseClipRegion = new Vector4(0, 0, 152f, 108f); } // } tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Texture").GetComponent<UITexture>().mainTexture = UtilMgr.GetTextureDefault(); tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Texture").GetComponent<UITexture>().color = new Color(1f, 1f, 1f, 50f/255f); UtilMgr.LoadImage(info.playerFK, tf.FindChild("BtnPhoto").FindChild("Panel").FindChild("Texture").GetComponent<UITexture>()); } else if(info.mType == CardInfo.INVEN_TYPE.PACK){ item.Target.transform.FindChild("ItemCardPack").gameObject.SetActive(true); item.Target.transform.FindChild("ItemCard").gameObject.SetActive(false); item.Target.transform.FindChild("ItemExpand").gameObject.SetActive(false); item.Target.transform.FindChild("ItemCardPack").FindChild("LblName").GetComponent<UILabel>().text = item.Target.GetComponent<ItemInvenCard>().mCardInfo.mMailinfo.mail_title; item.Target.transform.FindChild("ItemCardPack").FindChild("LblDesc").GetComponent<UILabel>().text = item.Target.GetComponent<ItemInvenCard>().mCardInfo.mMailinfo.mail_desc; } else if(info.mType == CardInfo.INVEN_TYPE.EXPAND){ item.Target.transform.FindChild("ItemCardPack").gameObject.SetActive(false); item.Target.transform.FindChild("ItemCard").gameObject.SetActive(false); item.Target.transform.FindChild("ItemExpand").gameObject.SetActive(true); item.Target.transform.FindChild("ItemExpand").FindChild("LblMoreCards1").GetComponent<UILabel>() .text = string.Format(UtilMgr.GetLocalText("LblMoreCards1"), mCardEvent.Response.data.Count - UserMgr.LobbyInfo.userInvenOfCard -1); } }