Exemple #1
0
 public static void CreateGFXConfig()
 {
     if (_instance == null)
     {
         _instance = new GFXConfig();
     }
 }
Exemple #2
0
    void Start()
    {
        //AndroidLogger.Instance.WriteToSDCard("EntryPoint Start Begin...");


        GameObject ui_root = GameObject.Find("UIRootCanvas");

        GFXConfig.CreateGFXConfig();

        // 隐藏FPS
        var transFPS = ui_root.transform.Find("Panel_FPS");

        if (transFPS != null)
        {
            _PanelFPS = transFPS.gameObject;
        }
        if (_PanelFPS)
        {
            _PanelFPS.SetActive(false);
        }

        //弹窗界面
        {
            UnityEngine.Object panelMessageBox = Resources.Load("UI/Panel_MessageBox", typeof(GameObject));
            if (panelMessageBox != null)
            {
                _PanelMessageBox = Instantiate(panelMessageBox) as GameObject;
                _PanelMessageBox.transform.SetParent(Main.PanelRoot);
                RectTransform rcTransform = _PanelMessageBox.GetComponent <RectTransform>();
                rcTransform.offsetMin                 = Vector2.zero;
                rcTransform.offsetMax                 = Vector2.zero;
                rcTransform.anchoredPosition3D        = Vector3.zero;
                _PanelMessageBox.transform.localScale = Vector3.one;
                _PanelMessageBox.FindChild("Frame_Message").SetActive(false);
            }
        }

        //更新界面   _PanelUpdate 在 UpdateRoutine() 中控制显隐
        {
            UnityEngine.Object panelHotUpdate = Resources.Load("UI/Panel_HotUpdate", typeof(GameObject));
            if (panelHotUpdate != null)
            {
                _PanelHotUpdate = Instantiate(panelHotUpdate) as GameObject;
                _PanelHotUpdate.transform.SetParent(ui_root.transform);
                RectTransform rcTransform = _PanelHotUpdate.GetComponent <RectTransform>();
                rcTransform.offsetMin                = Vector2.zero;
                rcTransform.offsetMax                = Vector2.zero;
                rcTransform.anchoredPosition3D       = Vector3.zero;
                _PanelHotUpdate.transform.localScale = Vector3.one;
                {
                    // TODO:加载更新图上的Tip和背景图更换
                }
                _PanelHotUpdate.SetActive(false);
            }
            else
            {
                //AndroidLogger.Instance.WriteToSDCard("Failed to Load Panel_HotUpdate!");
            }
        }


        StartCoroutine(PreInitGameCoroutine().GetEnumerator());

        StartCoroutine(InitGameCoroutine().GetEnumerator());

        //AndroidLogger.Instance.WriteToSDCard("EntryPoint Start End...");
    }
Exemple #3
0
    void Start()
    {
#if UNITY_IPHONE || UNITY_ANDROID
        _WriteLogLevel = LogLevel.Warning;
#endif

#if AssetsUnloadTest
        //test "Assets/Outputs/Scenes/SelectChar.prefab"
        SetupPath();
        CAssetBundleManager.Instance.Init(_ResPath, _AssetBundlePath);
        return;
#endif

        /*
         * {
         *  UnityEngine.Transform component = this.gameObject.transform;
         *  System.Reflection.PropertyInfo propertyInfo = CinemaSuite.Common.ReflectionHelper.GetProperty(typeof(UnityEngine.Transform), "localPosition");
         *  object value = propertyInfo.GetValue(component, null);
         *  //System.Reflection.MethodInfo mi = propertyInfo.GetGetMethod();
         *  //object value = mi.Invoke(component, null);
         * }
         * */
        /*
         * {
         *  GameObject obj = new GameObject("test1");
         *  Quaternion q = Quaternion.Euler(new Vector3(271.31f, 158.38f, 34.74f));
         *  Vector3 dir = q * Vector3.forward;
         *
         *  obj.transform.forward = dir;
         * }
         * */

        {
            GameObject go = GameObject.Find("UICamera");
            if (go != null)
            {
                Main.UICamera = go.GetComponent <Camera>();
            }
            go = GameObject.Find("UIRootCanvas");
            if (go != null)
            {
                Main.UIRootCanvas = go.transform;
                Main.PanelRoot    = go.transform.Find("PanelRoot");
                Main.PanelHUD     = go.transform.Find("Panel_HUD");
            }
            go = GameObject.Find("TopPateCanvas");
            {
                Main.TopPateCanvas = go.transform;
            }
            Main.BlockCanvas = Main.UIRootCanvas.Find("PanelRoot/BlockCanvas");
            Main.EnableBlockCanvas(false);
        }

        DeviceLogger.Instance.WriteLogFormat("EntryPoint Start Begin...");

        GFXConfig.CreateGFXConfig();

        // 隐藏FPS
        var transFPS = Main.UIRootCanvas.Find("Panel_FPS");
        if (transFPS != null)
        {
            _PanelFPS = transFPS.gameObject;
            _PanelFPS.SetActive(false);
        }

        //游戏Logo
        if (PanelLogo != null)
        {
            PanelLogo.SetActive(false);
        }

        //更新界面   _PanelUpdate 在 UpdateRoutine() 中控制显隐
        {
            UnityEngine.Object panelHotUpdate = Resources.Load("UI/Panel_HotUpdate", typeof(GameObject));
            if (panelHotUpdate != null)
            {
                PanelHotUpdate = Instantiate(panelHotUpdate) as GameObject;
                PanelHotUpdate.transform.SetParent(Main.PanelRoot);
                RectTransform rcTransform = PanelHotUpdate.GetComponent <RectTransform>();
                rcTransform.offsetMin               = Vector2.zero;
                rcTransform.offsetMax               = Vector2.zero;
                rcTransform.anchoredPosition3D      = Vector3.zero;
                PanelHotUpdate.transform.localScale = Vector3.one;
                {
                    // TODO:加载更新图上的Tip和背景图更换
                }
                PanelHotUpdate.SetActive(false);
            }
            else
            {
                DeviceLogger.Instance.WriteLog("Failed to Load Panel_HotUpdate!");
            }
        }

        //Splash界面
        {
            UnityEngine.Object panelSplash = Resources.Load("UI/Panel_Splash", typeof(GameObject));
            if (panelSplash != null)
            {
                _PanelSplash = Instantiate(panelSplash) as GameObject;
                _PanelSplash.transform.SetParent(Main.PanelRoot);
                //GameObject img = _PanelSplash.FindChild("Img_Splash");
                RectTransform rcTransform = _PanelSplash.GetComponent <RectTransform>();
                rcTransform.offsetMin             = Vector2.zero;
                rcTransform.offsetMax             = Vector2.zero;
                rcTransform.anchoredPosition3D    = Vector3.zero;
                _PanelSplash.transform.localScale = Vector3.one;

                _PanelSplash.SetActive(false);
            }
            else
            {
                DeviceLogger.Instance.WriteLog("Failed to Load Panel_Splash!");
            }
        }

        //游戏忠告界面
        {
            UnityEngine.Object panelMonition = Resources.Load("UI/Panel_Monition", typeof(GameObject));
            if (panelMonition != null)
            {
                _PanelMonition = Instantiate(panelMonition) as GameObject;
                _PanelMonition.transform.SetParent(Main.PanelRoot, false);
                //RectTransform rcTransform = _PanelMonition.GetComponent<RectTransform>();
                //rcTransform.offsetMin = Vector2.zero;
                //rcTransform.offsetMax = Vector2.zero;
                //rcTransform.anchoredPosition3D = Vector3.zero;
                //_PanelMonition.transform.localScale = Vector3.one;

                _PanelMonition.SetActive(false);
            }
            else
            {
                DeviceLogger.Instance.WriteLog("Failed to Load Panel_Monition!");
            }
        }

        try
        {
            _IsCurlInited = (CURLcode.CURLE_OK == Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL));
            if (!_IsCurlInited)
            {
                DeviceLogger.Instance.WriteLogFormat("Curl Init Failed: Curl.GlobalInit");
            }
            else
            {
                DeviceLogger.Instance.WriteLogFormat("Curl Init Succeed: {0}", Curl.Version);
            }
        }
        catch (Exception e)
        {
            DeviceLogger.Instance.WriteLogFormat("Curl Init Failed: {0}", e.Message);
        }

        StartCoroutine(InitGameCoroutine().GetEnumerator());
        DeviceLogger.Instance.WriteLogFormat("EntryPoint Start End...");
    }