private void ActiveWindow(ChildIndex index) { if (!controllers.ContainsKey(index)) { GameObject window = ResourceManager.Instance.LoadWindow(index.ToString()); controllers.Add(index, window); window.transform.parent = windowPanel.transform; window.transform.localScale = Vector3.one; window.SetActive(true); } foreach (ChildIndex key in controllers.Keys) { if (index == key) { controllers[key].transform.position = Vector3.zero; controllers[key].SetActive(true); lastPreviousWindowIndex = currentWindowIndex; currentWindowIndex = index; } else { controllers[key].SetActive(false); } } }
private void ActiveWindow(ChildIndex index) { // if(index == ChildIndex.GGLController) // { // MainController mc = mainController.GetComponent<MainController>(); // mc.ShowGGL(); // } // else // { // MainController mc = mainController.GetComponent<MainController>(); // mc.ShowtopInfo(); // } foreach (ChildIndex key in controllers.Keys) { if (index != key) { //controllers[key].SendMessage("CloseWindow", SendMessageOptions.DontRequireReceiver); controllers[key].SetActive(false); } } if (!controllers.ContainsKey(index)) { GameObject window = ResourceManager.Instance.LoadWindow(index.ToString()); controllers.Add(index, window); window.transform.parent = windowPanel.transform; window.transform.localScale = Vector3.one; window.transform.localPosition = Vector3.zero; } // else // { // controllers[index].SetActive(false); // } foreach (ChildIndex key in controllers.Keys) { if (index == key) { lastPreviousWindowIndex = currentWindowIndex; currentWindowIndex = index; controllers[key].transform.localPosition = Vector3.zero; controllers[key].SetActive(true); break; } } // for (int i = 0; i < childControllers.Length; i++) // { // if (i == index) // { // //ËùÓеĶŒÒÔ0,0,0µãΪ»ù׌£¬²»ÓÃÿžö¶ŒœšÊý×é //// childControllers[i].transform.localPosition = Vector3.zero;//arrayChildInpos[i]; // childControllers[i].transform.position = Vector3.zero; // childControllers[i].SetActive(true); // lastPreviousWindowIndex = currentWindowIndex; // currentWindowIndex = i; // } // else // { //// Debug.Log("set active false:"+i); // childControllers[i].SetActive(false); // } // } }