Beispiel #1
0
    // 对相关的单例与要初始化的数值在这里进行,最后进行版本检查加载
    private void Init()
    {
        Application.targetFrameRate = 60;

        AsyncTextureConst.AppName   = LuaFramework.AppConst.AppName;
        AsyncTextureConst.AssetDir  = LuaFramework.AppConst.AssetDir;
        AsyncTextureConst.DebugMode = LuaFramework.AppConst.DebugMode;
        AsyncTextureConst.ExtName   = LuaFramework.AppConst.ExtName;

        Stage.Instantiate();
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
#endif
        // uiRoot container
        UIPackage.AddPackage("UIRoot/Root");
        LayersMgr.CreateInstance().CreateFUI("UIRoot", "Root");
        //UIObjectFactory.SetLoaderExtension(typeof(GSprite));
        UIConfig.inputHighlightColor = new Color(0x2e, 0x33, 0x41);
        UIConfig.defaultFont         = "方正粗圆简体";//"SIMYOU,Microsoft YaHei";
        // 产品版本一般不启动 -> 启动异常捕获 (在发布设置 > 预编译加上 XH 或者为 AppConst.DebugMode)
#if XH
        ListonException();
        return;
#endif
        if (AppConst.DebugMode)
        {
            ListonException();
        }
    }
    void InitUISetting()
    {
#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
#endif
        UIConfig.defaultFont = "afont";
        GRoot.inst.SetContentScaleFactor(1152, 648, UIContentScaler.ScreenMatchMode.MatchHeight);
    }
Beispiel #3
0
    void Start()
    {
#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
#endif

        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Basics");

#if UNITY_5
        //Use the font names directly
        UIConfig.defaultFont = "Droid Sans,Droid Sans Fallback,Microsoft YaHei";
#else
        //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
        UIConfig.defaultFont = "afont";
#endif

        UIConfig.verticalScrollBar   = UIPackage.GetItemURL("Basics", "ScrollBar_VT");
        UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ");
        UIConfig.popupMenu           = UIPackage.GetItemURL("Basics", "PopupMenu");
        UIConfig.buttonSound         = (AudioClip)UIPackage.GetItemAsset("Basics", "click");

        _mainView = UIPackage.CreateObject("Basics", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _backBtn         = _mainView.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer  = _mainView.GetChild("container").asCom;
        _viewController = _mainView.GetController("c1");

        _demoObjects = new Dictionary <string, GComponent>();

        int cnt = _mainView.numChildren;
        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _mainView.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
            {
                obj.onClick.Add(runDemo);
            }
        }
    }
Beispiel #4
0
    void Awake()
    {
#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
#endif

#if (UNITY_5 || UNITY_5_3_OR_NEWER)
        //Use the font names directly
        UIConfig.defaultFont = "Microsoft YaHei";
#else
        //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
        UIConfig.defaultFont = "afont";
#endif
        UIPackage.AddPackage("UI/Basics");

        UIConfig.verticalScrollBar   = UIPackage.GetItemURL("Basics", "ScrollBar_VT");
        UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ");
        UIConfig.popupMenu           = UIPackage.GetItemURL("Basics", "PopupMenu");
        UIConfig.buttonSound         = (AudioClip)UIPackage.GetItemAsset("Basics", "click");
    }
    // Use this for initialization
    IEnumerator Start()
    {
                #if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
                #endif

        Application.targetFrameRate = 60;

//		Stage.inst.onKeyDown.Add(OnKeyDown);



        //EventContext



        DemoStart();

        yield return(new WaitForSeconds(10.0f));

        //mainView.Dispose();
    }