/// <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);
        }
Beispiel #2
0
 /// <summary>
 /// 统一驱动
 /// </summary>
 public static void Update()
 {
     //驱动输入
     ArcadeInputService.GetInstance().LogicUpdate();
     //驱动网络
     NetworkService.GetInstance().LogicUpdate();
     //Lua
     if (LuaService.IsValidate())
     {
         LuaService.GetInstance().LogicUpdate();
     }
     //UI
     UGUIRoot.GetInstance().CustomUpdate();
 }
    //*
    /// <summary>
    /// 逻辑初始化
    /// </summary>
    /// <param name="parameter">初始化参数</param>
    protected override void OnInitialize(object parameter)
    {
        //监听输入
        ArcadeInputService.GetInstance().RockerHandler += DealRockerInput;
        ArcadeInputService.GetInstance().PressHandler  += DealPressInput;
        //
        _cursorPos = 0;
        _numSB     = new StringBuilder();
        _numSB.Append("00000000000");
        _uiMIDShowText.text = _numSB.ToString();
        _state = InputState.Ready;
        //
        _uiMIDCursorRectTransform.anchoredPosition = new Vector2(_cursorPos * NumWidth, -55);
        _uiTipTextText.text = "";
        //
        Tweener tw = _uiMIDCursorRectTransform.DOShakeScale(0.15f);

        tw.SetLoops(-1);
    }
Beispiel #4
0
 /// <summary>
 /// 初始化Logic层
 /// </summary>
 /// <param name="initialize">初始化/反初始化</param>
 public static void InitLogic(bool initialize)
 {
     if (initialize)
     {
         //街机输入初始化
         ArcadeInputService.GetInstance();
         //模块初始化
         ModuleService.GetInstance();
         //注册C# 游戏模块
         ModuleService.GetInstance().Create <LaunchModule, UILaunchMediator>();
         ModuleService.GetInstance().Create <RegisterModule, UIRegisterMediator>();
         ModuleService.GetInstance().Create <UpdateModule, UIUpdateMediator>();
     }
     else
     {
         UGUIRoot.DestroyInstance();
         ModuleService.DestroyInstance();
         LuaService.DestroyInstance();
     }
 }
    protected override void OnAction(string id, object param)
    {
        if (id.Equals("DoRegisterMachine"))
        {
            if (_isInRegistering)
            {
                return;
            }
            //
            this.UpdateUI("ShowTip", "");
            _isInRegistering = true;
            //发送注册机器码HTTP请求
            _machineId = "M" + (string)param;
            string password = ArcadeInputService.GetInstance().GetDeviceKey();
            if (string.IsNullOrEmpty(password))
            {
                Log.LogE("Get Device Key  Nil Error");
                UpdateUI("ShowTip", "获取设备密钥异常,即将重启设备!");
                //开始重启倒计时
                _rebotCntDown = _rebootDuration;
                this.AddTimer(1000, true);
                return;
            }
            else
            {
                string urlFormat = string.Empty;
#if JW_DEBUG
                urlFormat = "http://ghtest.scbczx.com:60/machineUse?machineId={0}&password={1}";
#else
                urlFormat = "http://ghtest.scbczx.com:60/machineUse?machineId={0}&password={1}";
#endif
                string fullUrl = string.Format(urlFormat, _machineId, password);
                Log.LogD("Register Machine :" + fullUrl);
                //
                UICommonService.GetInstance().ShowWaiting("Register", true, "正在注册...");
                //
                HttpService.GetInstance().AsyncGetText(fullUrl, OnMachineRegisterBack);
            }
            return;
        }
    }
 public static ArcadeInputService GetArcadeInputService()
 {
     return(ArcadeInputService.GetInstance());
 }
 /// <summary>
 /// 逻辑反初始化
 /// </summary>
 protected override void OnUninitialize()
 {
     ArcadeInputService.GetInstance().RockerHandler -= DealRockerInput;
     ArcadeInputService.GetInstance().PressHandler  -= DealPressInput;
 }