예제 #1
0
 private void Awake()
 {
     DeviceChangeDetector = new DeviceChangeDetector();
     DeviceChangeDetector.OnDeviceChanged += DeviceChangeDetector_OnDeviceChanged;
     Controller = new MAJIKAInput();
     CurrentActiveDeviceType = DeviceClass.TouchScreen;
 }
예제 #2
0
        public override void Reload()
        {
            if (TextDefinitionAsset)
            {
                var deserializer = new YamlDotNet.Serialization.Deserializer();
                TextDefinitions = deserializer.Deserialize <Dictionary <string, string> >(TextDefinitionAsset.text);
            }
            KeyboardKeyText = new Dictionary <string, string>();
            GamepadKeyText  = new Dictionary <string, string>();
            input?.Disable();
            input = new MAJIKAInput();
            var regGamePad  = new Regex(@"<Gamepad>/(\S+)", RegexOptions.IgnoreCase | RegexOptions.ECMAScript);
            var regKeyboard = new Regex(@"<Keyboard>/(\S+)", RegexOptions.IgnoreCase | RegexOptions.ECMAScript);

            input.ForEach(action =>
            {
                var actionName = action.name.ToLower();
                InputActions.Add(actionName);
                action.bindings.Where(binding => !binding.isComposite)
                .ForEach(binding =>
                {
                    Debug.Log(binding.path);
                    // Gamepad
                    var match = regGamePad.Match(binding.path);
                    if (match.Success)
                    {
                        if (!GamepadKeyText.ContainsKey(actionName))
                        {
                            GamepadKeyText[actionName]  = TextDefinitions[binding.path];
                            TouchScreenText[actionName] = TextDefinitions[$"<Touch>/{match.Groups[1]}"];
                        }
                        else
                        {
                            GamepadKeyText[actionName]  = Utility.StringJoin(",", GamepadKeyText[actionName], TextDefinitions[binding.path]);
                            TouchScreenText[actionName] = Utility.StringJoin(",", KeyboardKeyText[actionName], TextDefinitions[$"<Touch>/{match.Groups[1]}"]);
                        }
                    }

                    // Keyboard
                    match = regKeyboard.Match(binding.path);
                    if (match.Success)
                    {
                        if (!KeyboardKeyText.ContainsKey(actionName))
                        {
                            KeyboardKeyText[actionName] = TextDefinitions[binding.path];
                        }
                        else
                        {
                            KeyboardKeyText[actionName] = Utility.StringJoin(",", KeyboardKeyText[actionName], TextDefinitions[binding.path]);
                        }
                    }
                });
            });
        }
예제 #3
0
 public ActionsActions(MAJIKAInput wrapper)
 {
     m_Wrapper = wrapper;
 }
예제 #4
0
 private void OnEnable()
 {
     inputAsset = new MAJIKAInput();
     inputAsset.GamePlay.SetCallbacks(this);
     inputAsset.Enable();
 }
예제 #5
0
 public GamePlayActions(MAJIKAInput wrapper)
 {
     m_Wrapper = wrapper;
 }