Exemplo n.º 1
0
        /// <summary>
        /// 更新する
        /// </summary>
        /// <param name="inputInfo">入力の情報</param>
        /// <param name="mouseInfo">マウスの情報</param>
        /// <param name="sound">サウンド</param>
        public void Update(InputInfoBase inputInfo, MouseInfo mouseInfo, ISound sound)
        {
            Sound = sound;
            if (previousScene != null)
            {
                previousScene.Dispose();
                if (!previousSceneResourceUsing && !PPDSetting.Setting.AllowedToUseMuchMemory && previousScene.ResourceManager != null)
                {
                    previousScene.ResourceManager.Dispose();
                }
                previousScene = null;
                device.GetModule <CharCacheManager>().ClearUnUsed();
            }
            if (nextScene != null)
            {
                if (LoadFinished)
                {
#if DEBUG
                    Console.WriteLine("LoadTime is:" + (Environment.TickCount - lastTime));
#if BENCHMARK
                    Benchmark.Instance.EndCategory();
#endif
#endif
                    loadingThread.Join();
                    loadingThread = null;
                    device.GetModule <CharCacheManager>().ClearUnUsed();
                    if (loadResult)
                    {
                        CurrentScene = nextScene;
                    }
                    else
                    {
                        previousScene = nextScene;
                        CurrentScene  = sceneStack.Pop();
                        CurrentScene.SceneStackPoped(new Dictionary <string, object>
                        {
                            { "Failed to initialize", "" }
                        });
                    }
                    nextScene = null;
                    if (LeaveLoading != null)
                    {
                        LeaveLoading.Invoke(this, EventArgs.Empty);
                    }
                }
            }
            if (CurrentScene != null)
            {
                CurrentScene.Update(inputInfo, mouseInfo);
            }
            if (loadingThread != null && LoadingScene != null)
            {
                LoadingScene.Update(inputInfo, mouseInfo);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 入力を処理する時によばれます
        /// </summary>
        /// <param name="inputInfo"></param>
        protected virtual bool OnProcessInput(InputInfoBase inputInfo)
        {
            if (Inputed != null)
            {
                var e = new InputEventArgs(inputInfo);
                Inputed.Invoke(this, e);
                return(e.Handled);
            }

            return(false);
        }
Exemplo n.º 3
0
        public override bool GetInput(Key[] keys, int[] buttons, int joyStickIndex, out PPDFramework.InputInfoBase inputInfo)
        {
            lock (settingLock)
            {
                if (this.keys == null)
                {
                    this.keys = new Key[keys.Length];
                }
                if (this.buttons == null)
                {
                    this.buttons = new int[buttons.Length];
                }

                this.keys = new Key[keys.Length];
                Array.Copy(keys, this.keys, keys.Length);
                Array.Copy(buttons, this.buttons, buttons.Length);
            }

            InputAction[] actions;
            Dictionary <ButtonType, InputAction> lastPress;

            lock (queue)
            {
                actions = queue.ToArray();
                queue.Clear();
            }
            lock (lastPressInfos)
            {
                lastPress = new Dictionary <ButtonType, InputAction>();
                foreach (KeyValuePair <ButtonType, InputAction> kvp in lastPressInfos)
                {
                    lastPress[kvp.Key] = kvp.Value;
                }
            }

            inputInfo = new AccurateInputInfo(actions, stopwatch, lastPress);

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 入力を処理します
        /// </summary>
        /// <param name="inputInfo"></param>
        public void ProcessInput(InputInfoBase inputInfo)
        {
            IFocusable temp    = CurrentFocusObject;
            int        current = stack.Count;

            for (int i = stack.Count - 1; i >= 0; i--)
            {
                if (i >= stack.Count)
                {
                    continue;
                }

                IFocusable focusable = stack[i];
                if (focusable.HandleOverFocusInput || focusable == temp)
                {
                    var handled = focusable.ProcessInput(inputInfo);
                    if (handled)
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// コンストラクタです
 /// </summary>
 /// <param name="inputInfo"></param>
 public InputEventArgs(InputInfoBase inputInfo)
 {
     InputInfo = inputInfo;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 入力を処理します
 /// </summary>
 /// <param name="inputInfo"></param>
 public bool ProcessInput(InputInfoBase inputInfo)
 {
     return(OnProcessInput(inputInfo));
 }
Exemplo n.º 7
0
 /// <summary>
 /// コンストラクタです。
 /// </summary>
 /// <param name="inputInfo"></param>
 public MenuInputInfo(InputInfoBase inputInfo)
     : base(inputInfo.Accurate)
 {
     baseInputInfo = inputInfo;
 }