private void Awake() { Screen.SetResolution(1280, 720, true); RankCellPool.Create("Prefab/RankCell", "RankCellPool", 50, 2); m_objRankContent.SetActive(false); UserSingleton.GetInstance().Refresh(delegate() { }); }
public void RemoveRankCell() { RankCell[] arrRank = { }; arrRank = gameObject.GetComponentsInChildren <RankCell>(); foreach (RankCell rankCell in arrRank) { RankCellPool.GetInstance().ReleaseObject(rankCell.gameObject); } }
public void LoadRankList() { Dictionary <int, JSONObject> mapRankList = null; float fUnit = 0.0f; float fStartYpos = 0.0f; float fContentHeight = 0.0f; fUnit = 50.0f; fStartYpos = -20.0f; fContentHeight = 50.0f; mapRankList = RankSingleton.GetInstance().GetRankerList(m_eCurrentTab); Debug.Log("RankListLength : " + mapRankList.Count.ToString()); foreach (KeyValuePair <int, JSONObject> item in mapRankList) { int nUserRank = 0; RankCell rankCell = null; GameObject objRankCell = null; JSONObject objUserInfo = null; RectTransform rectTransform = null; nUserRank = item.Key; objUserInfo = item.Value; objRankCell = RankCellPool.GetInstance().EnableObject(); rankCell = objRankCell.GetComponent <RankCell>(); rectTransform = objRankCell.GetComponent <RectTransform>(); rankCell.SetData(objUserInfo); objRankCell.transform.SetParent(transform); rectTransform.localPosition = new Vector2(0.0f, fStartYpos); rectTransform.offsetMin = new Vector2(20.0f, fStartYpos); rectTransform.offsetMax = new Vector2(-20.0f, fStartYpos); rectTransform.SetDefaultScale(); rectTransform.SetHeight(40.0f); fStartYpos -= fUnit; fContentHeight += fUnit; } GetComponent <RectTransform>().SetHeight(fContentHeight); }
public static RankCellPool Create ( string strPrefabName, // "해당 'Pool'에서 관리 할 프리팹의 이름" string strObjectName, // "'PoolObject'의 이름" int nPoolItemMaxCount, // "'Pool'에서 관리 할 오브젝트의 최고 개수" int nLayerLevel = 1 // 해당 풀의 레이어 계층 레벨을 정합니다. ) { GameObject objContainer = null; objContainer = new GameObject(); m_refInstance = objContainer.AddComponent(typeof(RankCellPool)) as RankCellPool; m_refInstance.m_strPrefabName = strPrefabName; m_refInstance.m_nObjectMaxCount = nPoolItemMaxCount; m_refInstance.gameObject.name = strObjectName; m_refInstance.gameObject.layer = nLayerLevel; m_refInstance.PreloadObject(); return(m_refInstance); }