Exemple #1
0
    public static void InitUIRoot()
    {
        GameObject rootCanvas = ResourceManager.GetGameObject(URLConst.GetUI("UIRoot"));
        Transform  canvas     = rootCanvas.transform.FindChild("UICanvas");
        GameObject tips       = rootCanvas.transform.FindChild("TipsLayer").gameObject;

        QuickTips.InitQuickTipsLayer(tips, 100);
        GameConst.auto = rootCanvas.transform.FindChild("auto").gameObject;
        UIEventHandlerBase.AddListener(GameConst.auto, UIEventType.ON_POINTER_CLICK, delegate(GameObject obj, BaseEventData evn)
        {
            ProtoReq.cancelAuto();
        });
        GameConst.auto.SetActive(false);
        AlertMgr.Instance.Init(rootCanvas.transform.FindChild("Alert").gameObject);
        AlertMgr.Instance._alert.SetActive(false);

        rootCanvas.SetActive(true);
        rootCanvas.transform.localScale = Vector3.one;
        GameObject.DontDestroyOnLoad(rootCanvas);

        GameObject eventSystem = GameObject.Find("EventSystem");

        if (eventSystem == null)
        {
            eventSystem = new GameObject("EventSystem");
            eventSystem.AddComponent <EventSystem>();
            eventSystem.AddComponent <StandaloneInputModule>();
            eventSystem.AddComponent <TouchInputModule>();
        }
        GameObject.DontDestroyOnLoad(eventSystem);
    }
Exemple #2
0
    void OnApplicationFocus(bool hasFocus)
    {
#if !UNITY_EDITOR
        if (!GameConst.isPlay)
        {
            return;
        }
        if (hasFocus)
        {
            ProtoReq.cancelAuto();
        }
        else
        {
            ProtoReq.changeAuto();
        }
#endif
    }