Esempio n. 1
0
        public override object VisitMachineBody(PParser.MachineBodyContext context)
        {
            foreach (var machineEntryContext in context.machineEntry())
            {
                switch (Visit(machineEntryContext))
                {
                case Variable[] fields:
                    CurrentMachine.AddFields(fields);
                    break;

                case Function method:
                    CurrentMachine.AddMethod(method);
                    break;

                case State state:
                    CurrentMachine.AddState(state);
                    break;

                case StateGroup group:
                    CurrentMachine.AddGroup(group);
                    break;

                default:
                    throw Handler.InternalError(machineEntryContext, "invalid machine entry");
                }
            }
            return(null);
        }
Esempio n. 2
0
    private IEnumerator Load(string path, string strSceneName)
    {
        string fullPath = LocalFileManager.Instance.LocalFilePath + path;

        if (!IOUtil.FileExists(fullPath))
        {
            DownloadDataEntity entity = DownloadManager.Instance.GetServerData(path);
            if (entity != null)
            {
                CurrentMachine.StartCoroutine(AssetBundleDownload.Instance.DownloadData(entity, (bool isSuccess) =>
                {
                    if (isSuccess)
                    {
                        AssetBundleManager.Instance.CheckDps(path, () =>
                        {
                            CurrentMachine.StartCoroutine(LoadScene(fullPath, strSceneName));
                        });
                    }
                }));
            }
        }
        else
        {
            AssetBundleManager.Instance.CheckDps(path, () =>
            {
                CurrentMachine.StartCoroutine(LoadScene(fullPath, strSceneName));
            });
        }
        yield return(null);
    }
Esempio n. 3
0
        public async void OnStart(object sender, EventArgs e)
        {
            var bootResult = await CurrentMachine?.Boot();

            // If there was an errors launching the machine
            if (bootResult.HasErrors)
            {
                MessageBox.Show(this, string.Join(Environment.NewLine, bootResult.Errors), MessageBoxType.Error);
            }
        }
Esempio n. 4
0
 public async Task When_input_is_sent_with_a_CommitNumber_and_StateBag(TInput input, long commitNumber, IDictionary <string, string> stateBag)
 {
     try
     {
         CurrentStatus = await CurrentMachine.SendAsync(input, commitNumber, stateBag);
     }
     catch (Exception ex)
     {
         CurrentException = ex;
     }
 }
Esempio n. 5
0
 public async Task When_input_and_a_payload_is_sent <TPayload>(TInput input, TPayload payload)
 {
     try
     {
         CurrentStatus = await CurrentMachine.SendAsync(input, payload);
     }
     catch (Exception ex)
     {
         CurrentException = ex;
     }
 }
Esempio n. 6
0
 public async Task When_input_is_sent(TInput input)
 {
     try
     {
         CurrentStatus = await CurrentMachine.SendAsync(input);
     }
     catch (Exception ex)
     {
         CurrentException = ex;
     }
 }
Esempio n. 7
0
        private Function CreateAnonFunction(PParser.NoParamAnonEventHandlerContext context)
        {
            var fun = new Function(context)
            {
                Owner = CurrentMachine,
                Scope = CurrentScope.MakeChildScope()
            };

            CurrentMachine.AddMethod(fun);

            nodesToDeclarations.Put(context, fun);
            return(fun);
        }
        public frmMachineManager()
        {
            InitializeComponent();

            StringCollection CurrentMachines = Properties.Settings.Default.Machines;

            machineBox.Items.Clear();

            CurrentMachines =
                foreach (string CurrentMachine in CurrentMachines)
            {
                machineBox.Items.Add(CurrentMachine.ToString());
            }
        }
Esempio n. 9
0
    /// <summary>
    /// 加载场景
    /// </summary>
    /// <returns></returns>
    private IEnumerator LoadingScene()
    {
        string strSceneName = "Scene_" + SceneMgr.Instance.CurrentSceneType.ToString();
        string path         = string.Format("download/{0}/scene/{1}.drb", ConstDefine.GAME_NAME, strSceneName.ToLower());

        if (string.IsNullOrEmpty(strSceneName))
        {
            yield break;
        }
#if DISABLE_ASSETBUNDLE && UNITY_EDITOR
        m_Async = SceneManager.LoadSceneAsync(strSceneName, LoadSceneMode.Additive);
        m_Async.allowSceneActivation = true;
        Debug.Log("加载场景" + strSceneName);
        yield return(null);
#else
        CurrentMachine.StartCoroutine(Load(path, strSceneName));
#endif
    }
Esempio n. 10
0
    public override void OnEnter()
    {
        base.OnEnter();
        UIDispatcher.Instance.AddEventListener(ConstDefine.BtnMyRoom, OnBtnMyRoomClick);                               //主界面我的房间按钮点击
        UIDispatcher.Instance.AddEventListener(ConstDefine.BtnSelectRoomViewRefresh, OnBtnSelectRoomViewRefreshClick); //主界面刷新按钮点击
        DelegateDefine.Instance.OnAutoJoinRoom += OnAutoJoinRoomCallBack;                                              //自动加入房间回调


        AudioBackGroundManager.Instance.Play("bgm_main");
        if (DelegateDefine.Instance.OnSceneLoadComplete != null)
        {
            DelegateDefine.Instance.OnSceneLoadComplete();
        }
        GameObject go = UIViewManager.Instance.LoadSceneUIFromAssetBundle(UIViewManager.SceneUIType.Main, () =>
        {
#if IS_TAILAI || IS_DAZHONG || IS_GUGENG
            UIViewManager.Instance.OpenWindow(UIWindowType.Ranking);
#endif
        });

        m_UISceneMainView = go.GetComponent <UISceneMainView>();
        List <cfg_gameEntity> lstEntity = cfg_gameDBModel.Instance.GetList();

        if (lstEntity != null)
        {
            m_UISceneMainView.SetUI(lstEntity, OnGameClick);
        }

        if (GlobalInit.Instance.IsAutoJoin)
        {
            OnAutoJoinRoomCallBack(GlobalInit.Instance.InviteRoomId, GlobalInit.Instance.ParentId);
        }
        else
        {
            GameCtrl.Instance.RequestRebuildRoom();
        }

        AccountCtrl.Instance.RequestCards();

        CurrentMachine.StartCoroutine(BeginRequestInform());
        RequestIcon();
    }
Esempio n. 11
0
    public override void OnEnter()
    {
        base.OnEnter();

        m_UILoadingView = UnityEngine.Object.FindObjectOfType(typeof(UISceneLoadingView)) as UISceneLoadingView;

        UIViewManager.Instance.CurrentUIScene = m_UILoadingView;

        m_Timer = Time.realtimeSinceStartup;
        //if (SceneMgr.Instance.CurrentSceneBundle != null)
        //{
        //    SceneMgr.Instance.CurrentSceneBundle.Unload(true);
        //    SceneMgr.Instance.CurrentSceneBundle = null;
        //}
        AudioEffectManager.Instance.StopAllAudio();
        UIViewManager.Instance.ClearWindows();
        //AssetBundleManager.Instance.UnloadAssetBundle();
        Resources.UnloadUnusedAssets();
        CurrentMachine.StartCoroutine(LoadingScene());
    }
Esempio n. 12
0
        private Function CreateAnonFunction(PParser.AnonEventHandlerContext context)
        {
            var fun = new Function(context)
            {
                Owner = CurrentMachine,
                Scope = CurrentScope.MakeChildScope()
            };

            CurrentMachine.AddMethod(fun);

            if (context.funParam() is PParser.FunParamContext paramContext)
            {
                var param = fun.Scope.Put(paramContext.name.GetText(), paramContext, VariableRole.Param);
                param.Type = ResolveType(paramContext.type());
                nodesToDeclarations.Put(paramContext, param);
                fun.Signature.Parameters.Add(param);
            }

            nodesToDeclarations.Put(context, fun);
            return(fun);
        }