/// <summary>
        /// 初始化
        /// </summary>
        public void Initialize(LuaEnv lua)
        {
            _onLoadAssetCompleted = lua.Global.GetInPath <OnLoadAssetCompletedDelegate>("AssetService.OnCsLoadAssetCompleted");
            _onChangeUIState      = lua.Global.GetInPath <OnChangeUIStateDelegate>("MVCService.OnCsChangeUIState");

            _onNativeCallBack = lua.Global.GetInPath <NativeServiceBaseDelegate>("NativeService.OnCommonCallback");

            _appEnterBackGroundCallBack = lua.Global.GetInPath <System.Action>("AppMoniter.OnCSAppEnterBackGround");
            _appEnterForeGroundCallBack = lua.Global.GetInPath <System.Action>("AppMoniter.OnCSAppEnterForeGround");

            //
            _arcadeInputOkCallBack      = lua.Global.GetInPath <ArcadeInputPressDelegate>("ArcadeInputService.OnCsOkInput");
            _arcadeInputRefreshCallBack = lua.Global.GetInPath <ArcadeInputRefreshDelegate>("ArcadeInputService.OnCsRefreshInput");
            _arcadeInputRotateCallBack  = lua.Global.GetInPath <ArcadeInputRotateDelegate>("ArcadeInputService.OnCsRotateInput");
            _arcadeInputRockerCallBack  = lua.Global.GetInPath <ArcadeInputRockerDelegate>("ArcadeInputService.OnCsRockerInput");
            //
            _gcCallBack = lua.Global.GetInPath <System.Action <bool> >("GCService.CollectGarbage");

            //挂接
            UIStateService.GetInstance().Hook    = this.ChangeUIState;
            AssetService.GetInstance().LuaGCHook = this.OnAssetServiceGC;
            //
            NativeService.GetInstance().RegisterBaseHandler(OnNativeBaseCallBackHook);
            //硬件输入
            ArcadeInputService.GetInstance().RockerHandler  = this.DealArcadeInputRockerInput;
            ArcadeInputService.GetInstance().RotateHandler  = this.DealArcadeInputRotateInput;
            ArcadeInputService.GetInstance().RefreshHandler = this.DealArcadeInputRefreshInput;
            ArcadeInputService.GetInstance().PressHandler   = this.DealArcadeInputOkInput;
            //
            _uiEventBridge = new LuaUIEventBridge();
            _uiEventBridge.Initialize(lua);
        }
        private string GetLifeStateName(int life)
        {
            switch (life)
            {
            case LifeType.Manual:
                return("Manual");

            case LifeType.UIState:
                return(UIStateService.IsValidate() ? UIStateService.GetInstance().CurrentStateName : string.Empty);
            }

            return(string.Empty);
        }
        //异步加载
        public void LoadAsyn(int type, int loadPriority, string filename, int life, IAssetLoadCallback callback, int cnt = 1)
        {
            string stateName = string.Empty;

            if (life == LifeType.Manual)
            {
                stateName = "Manual";
            }
            else if (life == LifeType.UIState)
            {
                stateName = UIStateService.IsValidate() ? UIStateService.GetInstance().CurrentStateName : string.Empty;
            }
            //
            AddLoad(loadPriority, callback, type, filename, life, stateName, cnt);
        }
Exemple #4
0
    public void OnStateEnter(object usrData = null)
    {
        EventService.GetInstance().AddEventHandler((uint)EventId.ApplicationPause, this, "OnApplicationPause");
        //界面
        UIStateService.GetInstance().ChangeState("UIUpdate");
        _isForceCheck    = false;
        _isNetCheck      = false;
        _netCheckCnt     = 10;
        _versionCheckCnt = 10;
#if UNITY_EDITOR
        DoNetworkCheck();
#else
        //检查用于强制更新的 程序
        DoUpdaterCheck();
#endif
    }
Exemple #5
0
    public void OnStateEnter(object usrData = null)
    {
        JW.Common.Log.LogD("Enter Register Machine State");
        //判断是否已经注册
        string machineId = PlayerPrefs.GetString("MachineID", string.Empty);

        if (string.IsNullOrEmpty(machineId))
        {
            UIStateService.GetInstance().ChangeState("UIRegister");
        }
        else
        {
            JW.Common.Log.LogD("<color=yellow>MachineID : {0}</color>", machineId);
            //到资源自动更新
            StateService.GetInstance().ChangeState("Update");
        }
    }
Exemple #6
0
 /// <summary>
 /// 初始化框架层
 /// </summary>
 /// <param name="initialize">初始化/反初始化</param>
 public static void InitFramework(bool initialize)
 {
     if (initialize)
     {
         NativeService.GetInstance();
         IFSService.GetInstance();
         AssetService.GetInstance();
         ScheduleService.GetInstance();
         EventService.GetInstance();
         StateService.GetInstance();
         HttpService.GetInstance();
         UGUIRoot.GetInstance();
         UIStateService.GetInstance();
         SceneService.GetInstance();
         UICommonService.GetInstance();
         AudioService.GetInstance();
         QualityService.GetInstance();
         NetworkService.GetInstance();
         NetAssetService.GetInstance();
     }
     else
     {
         IFSService.DestroyInstance();
         EventService.DestroyInstance();
         StateService.DestroyInstance();
         HttpService.DestroyInstance();
         UIStateService.DestroyInstance();
         SceneService.DestroyInstance();
         UICommonService.DestroyInstance();
         UGUIRoot.DestroyInstance();
         AudioService.DestroyInstance();
         NetworkService.DestroyInstance();
         NativeService.DestroyInstance();
         NetAssetService.DestroyInstance();
         QualityService.DestroyInstance();
         //最后
         ScheduleService.DestroyInstance();
         AssetService.GetInstance().Destroy();
         AssetService.DestroyInstance();
     }
 }
Exemple #7
0
    private void RestoreState()
    {
        try
        {
            UIStateService service = new UIStateService();

            GroupContext group = GroupContext.GetGroupContext();
            if (group != null && !String.IsNullOrEmpty(GroupContext.CurrentGroupID))
            {
                GroupInfo info = GroupContext.GetGroupContext().CurrentGroupInfo.CurrentGroup.GroupInformation;

                string family = info.Entity.ToLower();
                string name   = info.GroupName.ToLower();
                string data   = service.GetTaskletState(ID, "hidden:" + family + "-" + name);
                if (data != null)
                {
                    _hiddenFilters = new List <string>(JsonConvert.DeserializeObject <string[]>(data));
                }
            }
        }
        catch { }
    }
 //-----------------------------------------------------------------------
 public static UIStateService GetUIStateService()
 {
     return(UIStateService.GetInstance());
 }
    private void RestoreState()
    {
        try
        {
            UIStateService service = new UIStateService();

            GroupContext group = GroupContext.GetGroupContext();
            if (group != null && !String.IsNullOrEmpty(GroupContext.CurrentGroupID))
            {
                GroupInfo info = GroupContext.GetGroupContext().CurrentGroupInfo.CurrentGroup.GroupInformation;

                string family = info.Entity.ToLower();
                string name = info.GroupName.ToLower();
                string data = service.GetTaskletState(ID, "hidden:" + family + "-" + name);
                if (data != null)
                    _hiddenFilters = new List<string>(JsonConvert.DeserializeObject<string[]>(data));
            }
        }
        catch { }
    }
 public void OnStateEnter(object usrData = null)
 {
     Log.LogD("Enter Launch Game State");
     UIStateService.GetInstance().ChangeState("UILaunch");
     this.AddTimer(2000, false);
 }