public static void PostElementMessage(MiniMapElementStateType stateType, int id, MiniMapElementIconType iconType = MiniMapElementIconType.Empty) { if (elementDataActionDict.ContainsKey(stateType)) { elementDataActionDict[stateType](id, iconType); } }
public void CreateElementIcon(int id, MiniMapElementIconType iconType) { GameObject elementIcon = null; elementIcon = poolManager.TakeObject(iconType); elementIcon.SetActive(true); elementIconDict.Add(id, elementIcon.transform); }
private void RemoveElementDataListener(int id, MiniMapElementIconType iconType) { view.DestroyElementIcon(id); if (elementDataDict.ContainsKey(id)) { elementDataDict.Remove(id); } }
private void AddElementDataListener(int id, MiniMapElementIconType iconType) { if (!elementDataDict.ContainsKey(id)) { elementDataDict.Add(id, iconType); } view.CreateElementIcon(id, elementDataDict[id]); }
private void UpdateElementDataListener(int id, MiniMapElementIconType iconType) { if (!elementDataDict.ContainsKey(id)) { elementDataDict.Add(id, iconType); } else { view.UpdateElementIcon(id, iconType); } }
public void ReleaseObject(MiniMapElementIconType type, GameObject go) { go.SetActive(false); if (unusedPoolDict[type].Count >= memoryCount) { GameObject.Destroy(go); } else { unusedPoolDict[type].Add(go); } }
public void UpdateElementIcon(int id, MiniMapElementIconType iconType) { if (!elementIconDict.ContainsKey(id)) { return; } GameObject newIcon = null; newIcon = poolManager.TakeObject(iconType); newIcon.transform.localPosition = elementIconDict[id].localPosition; newIcon.SetActive(true); poolManager.ReleaseObject(controller.elementDataDict[id], elementIconDict[id].gameObject); controller.elementDataDict[id] = iconType; elementIconDict[id] = newIcon.transform; }
public GameObject TakeObject(MiniMapElementIconType type) { GameObject go = null; if (unusedPoolDict[type].Count > 0) { go = unusedPoolDict[type][0]; unusedPoolDict[type].RemoveAt(0); ResetOrder(go); } else { go = GameObject.Instantiate(Resources.Load(prefabPathDict[type])) as GameObject; go.SetActive(false); go.transform.SetParent(MiniMapView.Instance.elementIconParent, false); } return(go); }
public void UpdateIcon(MiniMapElementIconType iconType) { this.iconType = iconType; MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Update, id, iconType); }
public void Init(MiniMapElementIconType iconType) { id = MiniMapController.MakeId(); this.iconType = iconType; MiniMapMessageDispatcher.PostElementMessage(MiniMapElementStateType.Create, id, iconType); }