Esempio n. 1
0
    //-------------------------------------------------------------------------
    void _destory()
    {
        if (mEngine == null)
        {
            return;
        }

        if (mEngine != null)
        {
            mEngine.close();
            mEngine = null;
        }

        if (UiMgr != null)
        {
            UiMgr.destroy();
            UiMgr = null;
        }

        if (mSoundMgr != null)
        {
            mSoundMgr.destroy();
            mSoundMgr = null;
        }

        if (mAsyncLoadAssetMgr != null)
        {
            mAsyncLoadAssetMgr.destory();
            mAsyncLoadAssetMgr = null;
        }

        Screen.sleepTimeout = SleepTimeout.SystemSetting;

        EbLog.Note("MbMain._destory()");
    }
Esempio n. 2
0
 public void LoadLevel(string scene)
 {
     UpdateParameters();
     EventMgr.Instance.Clear();
     UiMgr.Clear();
     actorList.Clear();
     enemyList.Clear();
     Application.LoadLevel(scene);
 }
Esempio n. 3
0
        //---------------------------------------------------------------------
        public CasinosContext()
        {
            Instance = this;

            UiMgr = new UiMgr();
            UiMgr.RegUiFactory(new UiFactoryMain());
            UiMgr.CreateUi("Main");

            LuaMgr = new LuaMgr();
        }
Esempio n. 4
0
    //-------------------------------------------------------------------------
    void Start()
    {
        // 初始化系统参数
        {
            Application.runInBackground = true;
            Time.fixedDeltaTime         = 0.03f;
            Application.targetFrameRate = 60;
            Screen.sleepTimeout         = SleepTimeout.NeverSleep;
        }

        // 初始化日志
        {
            EbLog.NoteCallback    = Debug.Log;
            EbLog.WarningCallback = Debug.LogWarning;
            EbLog.ErrorCallback   = Debug.LogError;
        }

        EbLog.Note("MbMain.Start()");

        // 初始化PathMgr
        if (mPathMgr == null)
        {
            mPathMgr = new PathMgr();
        }

        if (mClientConfig == null)
        {
            mClientConfig = new ClientConfig();
        }

        if (mAsyncLoadAssetMgr == null)
        {
            mAsyncLoadAssetMgr = new AsyncLoadAssetMgr();
            mAsyncLoadAssetMgr.init();
        }

        if (mEngine == null)
        {
            EcEngineSettings settings;
            settings.ProjectName         = "Fishing";
            settings.RootEntityType      = "EtRoot";
            settings.EnableCoSuperSocket = true;
            mEngine = new EcEngine(ref settings, new EcEngineListener());
        }

        UiMgr = new UiMgr();
        UiMgr.create(EntityMgr.Instance);

        mSoundMgr = new CSoundMgr();

        // 创建EtClientApp
        EntityMgr.Instance.createEntity <EtApp>(null, EcEngine.Instance.EtNode);
    }
Esempio n. 5
0
    //-------------------------------------------------------------------------
    public void create(EntityMgr entity_mgr)
    {
        mUiMgr    = this;
        EntityMgr = entity_mgr;

        UIConfig.defaultFont = "Microsoft YaHei";

        UIPackage.AddPackage("Ui/Common");
        UIPackage.AddPackage("Ui/Main");
        UIPackage.AddPackage("Ui/Loading");
        UIPackage.AddPackage("Ui/Login");

        UIConfig.buttonSound = (AudioClip)UIPackage.GetItemAsset("Common", "Close");

        //UIConfig.verticalScrollBar = UIPackage.GetItemURL("Common", "ScrollBar_VT");
        //UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ");
        //UIConfig.popupMenu = UIPackage.GetItemURL("Basics", "PopupMenu");
        //GRoot.inst.SetContentScaleFactor(1136, 640);

        Stage.inst.onKeyDown.Add(_onKeyDown);
    }
Esempio n. 6
0
    //-------------------------------------------------------------------------
    void Update()
    {
        if (mEngine != null)
        {
            mEngine.update(Time.deltaTime);
        }

        if (UiMgr != null)
        {
            UiMgr.update(Time.deltaTime);
        }

        if (mSoundMgr != null)
        {
            mSoundMgr.update();
        }

        if (mAsyncLoadAssetMgr != null)
        {
            mAsyncLoadAssetMgr.update(Time.deltaTime);
        }
    }
Esempio n. 7
0
 //---------------------------------------------------------------------
 public void AddLog(string log)
 {
     UiMgr.GetUiMain().AddLog(log);
 }
Esempio n. 8
0
 //---------------------------------------------------------------------
 public void Destroy()
 {
     UiMgr.Destroy();
     LuaMgr.Destroy();
 }
Esempio n. 9
0
 //---------------------------------------------------------------------
 public void Update(float tm)
 {
     UiMgr.Update(tm);
     LuaMgr.Update(tm);
 }
Esempio n. 10
0
 //-------------------------------------------------------------------------
 public T genEvent <T>() where T : EntityEvent, new()
 {
     return(UiMgr.genEvent <T>());
 }
Esempio n. 11
0
    //-------------------------------------------------------------------------
    void _destory()
    {
        if (mEngine == null) return;

        if (mEngine != null)
        {
            mEngine.close();
            mEngine = null;
        }

        if (UiMgr != null)
        {
            UiMgr.destroy();
            UiMgr = null;
        }

        if (mSoundMgr != null)
        {
            mSoundMgr.destroy();
            mSoundMgr = null;
        }

        if (mAsyncLoadAssetMgr != null)
        {
            mAsyncLoadAssetMgr.destory();
            mAsyncLoadAssetMgr = null;
        }

        Screen.sleepTimeout = SleepTimeout.SystemSetting;

        EbLog.Note("MbMain._destory()");
    }
Esempio n. 12
0
    //-------------------------------------------------------------------------
    void Start()
    {
        // 初始化系统参数
        {
            Application.runInBackground = true;
            Time.fixedDeltaTime = 0.03f;
            Application.targetFrameRate = 60;
            Screen.sleepTimeout = SleepTimeout.NeverSleep;
        }

        // 初始化日志
        {
            EbLog.NoteCallback = Debug.Log;
            EbLog.WarningCallback = Debug.LogWarning;
            EbLog.ErrorCallback = Debug.LogError;
        }

        EbLog.Note("MbMain.Start()");

        // 初始化PathMgr
        if (mPathMgr == null)
        {
            mPathMgr = new PathMgr();
        }

        if (mClientConfig == null)
        {
            mClientConfig = new ClientConfig();
        }

        if (mAsyncLoadAssetMgr == null)
        {
            mAsyncLoadAssetMgr = new AsyncLoadAssetMgr();
            mAsyncLoadAssetMgr.init();
        }

        if (mEngine == null)
        {
            EcEngineSettings settings;
            settings.ProjectName = "Fishing";
            settings.RootEntityType = "EtRoot";
            mEngine = new EcEngine(ref settings, new EcEngineListener());
        }

        UiMgr = new UiMgr();
        UiMgr.create(EntityMgr.Instance);

        mSoundMgr = new CSoundMgr();

        // 创建EtClientApp
        EntityMgr.Instance.createEntity<EtApp>(null, EcEngine.Instance.EtNode);
    }