void OnWndMapItemDoubleClick(UICustomMapItem item) { if (item.IsFile) { mCurPath = mMapItems[item.index].Path; UpdateMapItem(mCurPath); } }
void OnWndMapItemSetContent(int index, UICustomMapItem item) { try { item.IsFile = mMapItems[index].IsDir; item.nameStr = mMapItems[index].Name; } catch (System.Exception e) { Debug.LogError(e.ToString()); } }
void IListReceiver.ClearContent(GameObject go) { UICustomMapItem item = go.GetComponent <UICustomMapItem>(); item.index = -1; item.IsSelected = false; item.onClick -= OnMapItemClick; item.onDoubleClick -= OnMapItemDbClick; if (onMapItemClearContent != null) { onMapItemClearContent(item); } }
void IListReceiver.SetContent(int index, GameObject go) { UICustomMapItem item = go.GetComponent <UICustomMapItem>(); item.index = index; item.onClick -= OnMapItemClick; item.onDoubleClick -= OnMapItemDbClick; item.onClick += OnMapItemClick; item.onDoubleClick += OnMapItemDbClick; if (onMapItemSetContent != null) { onMapItemSetContent(index, item); } }
void OnMapItemClick(UICustomMapItem item) { for (int i = 0; i < mapItemGrid.Gos.Count; i++) { UICustomMapItem it = mapItemGrid.Gos[i].GetComponent <UICustomMapItem>(); it.IsSelected = false; } item.IsSelected = true; mSelectedItem = item; if (item.IsFile) { // Hide All Right Information if (mapInfo.root.activeSelf) { mapInfo.root.SetActive(false); } if (playerInfo.root != null) { if (playerInfo.root.activeSelf) { playerInfo.root.SetActive(false); } } } else { if (!mapInfo.root.activeSelf) { mapInfo.root.SetActive(true); } if (playerInfo.root != null) { if (!playerInfo.root.activeSelf) { playerInfo.root.SetActive(true); } } if (onMapItemClick != null) { onMapItemClick(mapInfo, playerInfo, item); } } }
void OnMapItemDbClick(UICustomMapItem item) { if (onMapItemDoubleClick != null) { onMapItemDoubleClick(item); } if (item.IsFile) { mSelectedItem = null; } else { OnMapItemClick(item); } }
void OnBackClick() { if (onBack != null) { if (onBack()) { if (mSelectedItem != null) { mSelectedItem.IsSelected = false; mSelectedItem = null; } mapInfo.root.SetActive(false); if (playerInfo.root != null) { playerInfo.root.SetActive(false); } } } }
void OnWndMapItemClick(UICustomGameSelectWnd.CMapInfo mapInfo, UICustomGameSelectWnd.CPlayerInfo playerInfo, UICustomMapItem item) { if (mMapItems.Count <= item.index) { return; } MapItemDescs desc = mMapItems[item.index]; Pathea.CustomGameData customdata = null; try { customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path); } catch { mapInfo.texture.mainTexture = null; mapInfo.name.text = "crap"; mapInfo.size.text = "crap"; } finally { mapInfo.texture.mainTexture = customdata.screenshot; mapInfo.name.text = customdata.name.ToString(); mapInfo.size.text = customdata.size.x.ToString() + "X" + customdata.size.z.ToString(); PlayerDesc[] human_descs = customdata.humanDescs; if (human_descs.Length > 0 && playerInfo.playerList != null) { playerInfo.playerList.items.Clear(); foreach (PlayerDesc pd in human_descs) { playerInfo.playerList.items.Add(pd.Name); } playerInfo.playerList.selection = human_descs[0].Name; } else { playerInfo.playerList.items.Clear(); playerInfo.playerList.selection = " "; } } }
void OnWndMapItemClearContent(UICustomMapItem item) { }
void OnWndMapItemClick(UICustomGameSelectWnd.CMapInfo mapInfo, UICustomGameSelectWnd.CPlayerInfo playerInfo, UICustomMapItem item) { MapItemDescs desc = mMapItems[item.index]; Pathea.CustomGameData customdata = null; try { customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path); } catch { mapInfo.texture.mainTexture = null; mapInfo.name.text = "crap"; mapInfo.size.text = "crap"; } finally { mapInfo.texture.mainTexture = customdata.screenshot; mapInfo.name.text = customdata.name.ToString(); mapInfo.size.text = customdata.size.x.ToString() + "X" + customdata.size.z.ToString(); //PlayerDesc[] human_descs = customdata.humanDescs; //playerInfo.playerList.items.Clear(); //foreach (PlayerDesc pd in human_descs) //{ // playerInfo.playerList.items.Add(pd.Name); //} //playerInfo.playerList.selection = human_descs[0].Name; } hostCreatCtrl.UID = desc.UID; }