UI_PVPWinnerScrollFlowComponment.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. //using UnityEngine;
  2. //using System.Collections;
  3. //using System;
  4. //using System.Collections.Generic;
  5. ///// <summary>
  6. /////
  7. ///// </summary>
  8. //public class UI_PVPWinnerScrollFlowComponment : MonoBehaviour
  9. //{
  10. // /// <summary>
  11. // /// 操作控制层
  12. // /// </summary>
  13. // public UI_ScrollFlow mScrollFlow;
  14. // /// <summary>
  15. // /// 模板
  16. // /// </summary>
  17. // public GameObject mPrefab;
  18. // /// <summary>
  19. // /// 子对象节点
  20. // /// </summary>
  21. // public GameObject mNodes;
  22. // /// <summary>
  23. // ///
  24. // /// </summary>
  25. // private bool isDetial = false;
  26. // /// <summary>
  27. // /// 初始化UI
  28. // /// </summary>
  29. // public void InitComponments(bool isDetial = false)
  30. // {
  31. // this.isDetial = isDetial;
  32. // mPrefab = this.transform.Find("prefab").gameObject;
  33. // mPrefab.SetActive(false);
  34. // mNodes = this.transform.Find("Nodes").gameObject;
  35. // mScrollFlow = mNodes.GetComponent<UI_ScrollFlow>();
  36. // if (mScrollFlow == null)
  37. // {
  38. // AssemblyHelper.Instance.BindScript("UI_ScrollFlow", mNodes);
  39. // mScrollFlow = mNodes.GetComponent<UI_ScrollFlow>();
  40. // }
  41. // mNodes.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -100);
  42. // mScrollFlow.InitPvp_ComponmentsSetting();
  43. // mScrollFlow.goItemPrefab = mPrefab;
  44. // mScrollFlow.nodeContent = mNodes.GetComponent<RectTransform>();
  45. // CreateElement();
  46. // }
  47. // /// <summary>
  48. // /// 创建元素
  49. // /// </summary>
  50. // private void CreateElement()
  51. // {
  52. // mScrollFlow.onInitializeItem = onInitializeItem;
  53. // mScrollFlow.Init(0);
  54. // }
  55. // /// <summary>
  56. // /// 元素初始化
  57. // /// </summary>
  58. // /// <param name="go"> 元素对象 </param>
  59. // /// <param name="dataIndex"> 数据索引 </param>
  60. // private void onInitializeItem(GameObject go, int dataIndex)
  61. // {
  62. // UI_Pvp_PreviousWinnerElement element = go.GetComponent<UI_Pvp_PreviousWinnerElement>();
  63. // if (null == element)
  64. // {
  65. // AssemblyHelper.Instance.BindScript("UI_Pvp_PreviousWinnerElement", go);
  66. // element = go.GetComponent<UI_Pvp_PreviousWinnerElement>();
  67. // }
  68. // element.Init(this.isDetial);
  69. // element.Action_SelectedSomeCard = OnClicked_Select;
  70. // if (dataIndex >= 0 && dataIndex < mDataList.Count)
  71. // {
  72. // element.SetData(dataIndex,mDataList[dataIndex]);
  73. // if (elements.ContainsKey(dataIndex))
  74. // {
  75. // elements[dataIndex] = go;
  76. // }
  77. // else
  78. // {
  79. // elements.Add(dataIndex, go);
  80. // }
  81. // }
  82. // }
  83. // /// <summary>
  84. // /// 刷新元素
  85. // /// </summary>
  86. // /// <param name="heroUIDList">英雄列表</param>
  87. // /// <param name="bResetPos"> 是否重设位置 </param>
  88. // public void SetHeroData(List<PvpChallengerDataVo> heroUIDList, bool bResetPos = false)
  89. // {
  90. // mDataList = new List<PvpChallengerDataVo>();
  91. // elements = new Dictionary<int, GameObject>();
  92. // mDataList.AddRange(heroUIDList);
  93. // mScrollFlow.Hero_DataChanged(heroUIDList.Count, bResetPos);
  94. // if (heroUIDList.Count == 0)
  95. // {
  96. // mScrollFlow.enabled = false;
  97. // }
  98. // else
  99. // {
  100. // mScrollFlow.enabled = true;
  101. // }
  102. // }
  103. // /// <summary>
  104. // /// 数据列表
  105. // /// </summary>
  106. // private List<PvpChallengerDataVo> mDataList = new List<PvpChallengerDataVo>();
  107. // /// <summary>
  108. // /// 子对象集合
  109. // /// </summary>
  110. // private Dictionary<int, GameObject> elements = new Dictionary<int, GameObject>();
  111. // /// <summary>
  112. // /// 点击卡牌事件
  113. // /// </summary>
  114. // internal Action<int> Action_SelectedSomeCard;
  115. // /// <summary>
  116. // /// 点击选择
  117. // /// </summary>
  118. // /// <param name="go">按钮对象</param>
  119. // private void OnClicked_Select(GameObject go)
  120. // {
  121. // UI_ScrollFlow_Item script = go.GetComponent<UI_ScrollFlow_Item>();
  122. // if (script == null)
  123. // {
  124. // return;
  125. // }
  126. // if (mScrollFlow.Current != script)
  127. // {
  128. // mScrollFlow.ToAppointedItem(script);
  129. // }
  130. // else
  131. // {
  132. // UI_Pvp_PreviousWinnerElement ele = go.GetComponent<UI_Pvp_PreviousWinnerElement>();
  133. // if (ele == null)
  134. // {
  135. // return;
  136. // }
  137. // if (Action_SelectedSomeCard != null)
  138. // {
  139. // Action_SelectedSomeCard(mScrollFlow.Current.Index);
  140. // }
  141. // }
  142. // }
  143. // /// <summary>
  144. // ///
  145. // /// </summary>
  146. // /// <param name="index"></param>
  147. // public void SetCurrentIndexForOther(int index)
  148. // {
  149. // if (mScrollFlow.Current.Index != index)
  150. // {
  151. // UI_ScrollFlow_Item script = mNodes.transform.Find(index.ToString()).GetComponent<UI_ScrollFlow_Item>();
  152. // if (script != null)
  153. // {
  154. // mScrollFlow.ToAppointedItem(script);
  155. // }
  156. // }
  157. // }
  158. //}