/// <summary> /// 设置滑动列表 /// </summary> private void SetScrollView(object oSender, object oParam) { ClearView(); Dictionary <int, InstanceResp> dInstanceData = this.m_Model.GetInstanceData(); List <int> IDList = new List <int> (); foreach (int iID in dInstanceData.Keys) { IDList.Add(iID); } IDList.Sort(); foreach (int iInstanceID in IDList) { GameObject oItem = Instantiate(Pf_Instance) as GameObject; this.m_InstanceItemList.Add(oItem); oItem.name = iInstanceID.ToString(); InstanceResp oInstance = dInstanceData [iInstanceID]; oItem.GetComponent <InsItem> ().SetItemView(oInstance.time, oInstance.name, oInstance.desp, oInstance.amount); oItem.transform.transform.SetParent(this.Scr_Content.transform); oItem.transform.localPosition = this.m_StartPoint; this.m_StartPoint += new Vector3(0, -this.m_ItemHeight, 0); oItem.GetComponent <Button> ().onClick.AddListener(delegate { this.OnItemClicked(oItem); }); } }
//对外接口 public void StartInstance(int iInstanceID, InstanceResp oInstance) { Debug.Log(iInstanceID); this.m_iInstanceID = iInstanceID; this.m_Instance = oInstance; UIManager.Instance.CloseAllView(); ShipManager.Instance.CreateNewInstance(iInstanceID, oInstance); UIManager.Instance.ShowViewByName(Constant.UI_Game); }
/// <summary> /// 创建新实例 /// </summary> /// <param name="iInstanceID">实例ID</param> /// <param name="oInstance">实例数据</param> public void CreateNewInstance(int iInstanceID, InstanceResp oInstance) { foreach (string sShipID in oInstance.shape.Keys) { CreateNewShip(int.Parse(sShipID)); } this.m_iInstanceID = iInstanceID; GlobalManager.Instance.IsGameRunning = true; if (this.m_ShipDict.Count > 0) { CameraController.Instance.LookAtObject = this.m_ShipDict [1]; } }