コード例 #1
0
        public IActionResult Post(InputCategory model)
        {
            var result = categoryService.Create(model);

            //paging, filter
            return(Ok(new { success = result.Success, Message = result.Message }));
        }
コード例 #2
0
        public IActionResult Put(int id, InputCategory model)
        {
            var result = categoryService.Update(id, model);

            //paging, filter
            return(Ok(new { success = result.Success, Message = result.Message }));
        }
コード例 #3
0
 public void ReadFromConfig(ConfigFile config)
 {
     this.name = config.Get("Emulation.DeviceName", this.name.ToString());
     string str1 = config.Get("Emulation.OSCategory", this.os.ToString());
     string str2 = config.Get("Emulation.InputCategory", this.input.ToString());
     string str3 = config.Get("Emulation.ScreenCategory", this.screen.ToString());
     string str4 = config.Get("Emulation.ScreenDensityCategory", this.screenDensity.ToString());
     Log.ConfigFile.Print("Reading Emulated Device: " + this.name + " from " + config.GetPath());
     try
     {
       this.os = (OSCategory) Enum.Parse(typeof (OSCategory), str1);
       this.input = (InputCategory) Enum.Parse(typeof (InputCategory), str2);
       this.screen = (ScreenCategory) Enum.Parse(typeof (ScreenCategory), str3);
       this.screenDensity = (ScreenDensityCategory) Enum.Parse(typeof (ScreenDensityCategory), str4);
     }
     catch (ArgumentException ex)
     {
       string format = "Could not parse {0} in {1} as a valid device!";
       object[] objArray = new object[2];
       int index1 = 0;
       string str5 = this.name;
       objArray[index1] = (object) str5;
       int index2 = 1;
       string path = config.GetPath();
       objArray[index2] = (object) path;
     //      Blizzard.Log.Warning(format, objArray);
     }
 }
コード例 #4
0
 private static void RecomputeDeviceSettings()
 {
     if (!EmulateMobileDevice())
     {
         s_os            = OSCategory.PC;
         s_input         = InputCategory.Mouse;
         s_screen        = ScreenCategory.PC;
         s_screenDensity = ScreenDensityCategory.High;
         s_os            = OSCategory.PC;
         int systemMemorySize = SystemInfo.systemMemorySize;
         if (systemMemorySize < 500)
         {
             Debug.LogWarning("Low Memory Warning: Device has only " + systemMemorySize + "MBs of system memory");
             s_memory = MemoryCategory.Low;
         }
         else if (systemMemorySize < 0x3e8)
         {
             s_memory = MemoryCategory.Low;
         }
         else if (systemMemorySize < 0x5dc)
         {
             s_memory = MemoryCategory.Medium;
         }
         else
         {
             s_memory = MemoryCategory.High;
         }
     }
 }
コード例 #5
0
    private static bool EmulateMobileDevice()
    {
        ConfigFile config = new ConfigFile();

        if (!config.FullLoad(Vars.GetClientConfigPath()))
        {
            Blizzard.Log.Warning("Failed to read DeviceEmulation from client.config");
            return(false);
        }
        DevicePreset preset = new DevicePreset();

        preset.ReadFromConfig(config);
        if (preset.name == "No Emulation")
        {
            return(false);
        }
        if (!config.Get("Emulation.emulateOnDevice", false))
        {
            return(false);
        }
        s_os            = preset.os;
        s_input         = preset.input;
        s_screen        = preset.screen;
        s_screenDensity = preset.screenDensity;
        Log.DeviceEmulation.Print("Emulating an " + preset.name, new object[0]);
        return(true);
    }
コード例 #6
0
 public OperationResult Create(InputCategory model)
 {
     _context.Categories.Add(new Category
     {
         Name = model.Name
     });
     _context.SaveChanges();
     return(OperationResult.Successed());
 }
コード例 #7
0
ファイル: LanguageData.cs プロジェクト: dynopa/rewilding
        public override string GetActionCategoryName(int id)
        {
            InputCategory category = ReInput.mapping.GetActionCategory(id);

            if (category == null)
            {
                throw new ArgumentException("Invalid action category id: " + id);
            }
            return(category.descriptiveName);
        }
コード例 #8
0
ファイル: InputManager.cs プロジェクト: gormed/darwin
    public void UnregisterListener(InputCategory category, IInputListener listener)
    {
        List <IInputListener> listenerList;

        if (m_CategoryInputListener.TryGetValue(category, out listenerList))
        {
            listenerList.Remove(listener);
        }
        else
        {
            // TODO hans: handle errors
        }
    }
コード例 #9
0
        public OperationResult Update(int id, InputCategory model)
        {
            var selectedCategory = _context.Categories.Find(id);

            if (selectedCategory == null)
            {
                return(OperationResult.NotFound());
            }

            selectedCategory.Name = model.Name;

            _context.Update(selectedCategory);
            _context.SaveChanges();
            return(OperationResult.Successed());
        }
    private T GetInputSetting(InputCategory input)
    {
        switch (input)
        {
        case InputCategory.Mouse:
            if (this.MouseSetting.WasSet)
            {
                return(this.Mouse);
            }
            break;

        case InputCategory.Touch:
            return(!this.TouchSetting.WasSet ? this.GetInputSetting(InputCategory.Mouse) : this.Touch);
        }
        Debug.LogError("Could not find input dependent value");
        return(default(T));
    }
コード例 #11
0
    public void ReadFromConfig(ConfigFile config)
    {
        this.name = config.Get("Emulation.DeviceName", this.name.ToString());
        string str  = config.Get("Emulation.OSCategory", this.os.ToString());
        string str2 = config.Get("Emulation.InputCategory", this.input.ToString());
        string str3 = config.Get("Emulation.ScreenCategory", this.screen.ToString());
        string str4 = config.Get("Emulation.ScreenDensityCategory", this.screenDensity.ToString());

        Log.ConfigFile.Print("Reading Emulated Device: " + this.name + " from " + config.GetPath(), new object[0]);
        try
        {
            this.os            = (OSCategory)((int)Enum.Parse(typeof(OSCategory), str));
            this.input         = (InputCategory)((int)Enum.Parse(typeof(InputCategory), str2));
            this.screen        = (ScreenCategory)((int)Enum.Parse(typeof(ScreenCategory), str3));
            this.screenDensity = (ScreenDensityCategory)((int)Enum.Parse(typeof(ScreenDensityCategory), str4));
        }
        catch (ArgumentException)
        {
            object[] args = new object[] { this.name, config.GetPath() };
            Blizzard.Log.Warning("Could not parse {0} in {1} as a valid device!", args);
        }
    }
コード例 #12
0
 private static bool EmulateMobileDevice()
 {
     ConfigFile config = new ConfigFile();
     if (!config.FullLoad(Vars.GetClientConfigPath()))
     {
     Debug.LogWarning("Failed to read DeviceEmulation from client.config");
     return false;
     }
     DevicePreset devicePreset = new DevicePreset();
     devicePreset.ReadFromConfig(config);
     if (devicePreset.name == "No Emulation" || !config.Get("Emulation.emulateOnDevice", false))
       return false;
     PlatformSettings.s_os = devicePreset.os;
     PlatformSettings.s_input = devicePreset.input;
     PlatformSettings.s_screen = devicePreset.screen;
     PlatformSettings.s_screenDensity = devicePreset.screenDensity;
     Log.DeviceEmulation.Print("Emulating an " + devicePreset.name);
     return true;
 }
コード例 #13
0
 private static void WriteCategorySummary(ConstantsWriter writer, InputCategory ic)
 {
     writer.WriteLine("/// <summary>");
     writer.WriteLine("/// Descriptive Name: {0}", ic.descriptiveName);
     writer.WriteLine("/// ID: {0}", ic.id);
     writer.WriteLine("/// </summary>");
 }
コード例 #14
0
ファイル: InputManager.cs プロジェクト: gormed/darwin
 public KeyCategory(InputCategory category, InputType type, string name)
 {
     Category = category;
     Type     = type;
     Name     = name;
 }
コード例 #15
0
 private OutputOrgType TransformOrgType(InputCategory inputCategory)
 {
     return((OutputOrgType)inputCategory);
 }
コード例 #16
0
 private static void SetAndroidSettings()
 {
     s_os    = OSCategory.Android;
     s_input = InputCategory.Touch;
 }
コード例 #17
0
 private static void RecomputeDeviceSettings()
 {
     if (PlatformSettings.EmulateMobileDevice())
       return;
     PlatformSettings.s_os = OSCategory.PC;
     PlatformSettings.s_input = InputCategory.Mouse;
     PlatformSettings.s_screen = ScreenCategory.PC;
     PlatformSettings.s_screenDensity = ScreenDensityCategory.High;
     PlatformSettings.s_os = OSCategory.PC;
     int systemMemorySize = SystemInfo.systemMemorySize;
     if (systemMemorySize < 500)
     {
       Debug.LogWarning((object) ("Low Memory Warning: Device has only " + (object) systemMemorySize + "MBs of system memory"));
       PlatformSettings.s_memory = MemoryCategory.Low;
     }
     else if (systemMemorySize < 1000)
       PlatformSettings.s_memory = MemoryCategory.Low;
     else if (systemMemorySize < 1500)
       PlatformSettings.s_memory = MemoryCategory.Medium;
     else
       PlatformSettings.s_memory = MemoryCategory.High;
 }
コード例 #18
0
 private static void SetAndroidSettings()
 {
     PlatformSettings.s_os = OSCategory.Android;
     PlatformSettings.s_input = InputCategory.Touch;
 }
コード例 #19
0
ファイル: KeyBindingPanel.cs プロジェクト: Verbess/Born
        void ShowKeybindingTables(int selectedCategoryId, ControllerMap selectedMap)
        {
            InputMapCategory mapCategory = ReInput.mapping.GetMapCategory(selectedCategoryId);

            if (mapCategory == null)
            {
                DebugHelper.Log("不存在");
                return;
            }

            InputCategory actionCategory = ReInput.mapping.GetActionCategory(mapCategory.name);

            if (actionCategory == null)
            {
                DebugHelper.Log("不存在");
                return;
            }

            GameObject bd           = Instantiate(keysBdPrefab, rootBd.transform);
            int        siblingIndex = 0;

            if (controllerType == ControllerType.Joystick)
            {
                siblingIndex = 3;
            }
            else if (controllerType == ControllerType.Keyboard)
            {
                siblingIndex = 2;
            }
            bd.transform.SetSiblingIndex(bd.transform.parent.childCount - siblingIndex);
            keysBdList.Add(bd);

            foreach (InputAction inputAction in ReInput.mapping.ActionsInCategory(mapCategory.name))
            {
                string keyName = inputAction.descriptiveName != string.Empty ? inputAction.descriptiveName : inputAction.name;

                var list = new List <ActionElementMap>(selectedMap.AllMaps);
                // list.Sort((x, y) => x.actionId.CompareTo(y.actionId));

                if (inputAction.type == InputActionType.Button)
                {
                    foreach (ActionElementMap ele in list)
                    {
                        if (ele.actionId != inputAction.id || !inputAction.userAssignable)
                        {
                            continue;
                        }
                        OneKeyBinding kb = Instantiate(keyBindingPrefab, bd.transform);
                        kb.HandleListening += HandleListening;
                        kb.RenderKey(playerId, inputAction, AxisRange.Positive, selectedMap.controllerType, selectedMap, ele);
                        keyBindingList.Add(kb);
                    }
                }
                else if (inputAction.type == InputActionType.Axis)
                {
                    if (controllerType == ControllerType.Joystick)
                    {
                        continue;
                    }

                    foreach (ActionElementMap ele in selectedMap.AllMaps)
                    {
                        if (ele.actionId != inputAction.id || !inputAction.userAssignable)
                        {
                            continue;
                        }
                        if (ele.axisType == AxisType.Normal)
                        {
                            continue;
                        }

                        if (ele.axisContribution != Pole.Positive && ele.axisContribution != Pole.Negative)
                        {
                            continue;
                        }
                        AxisRange axisRange = ele.axisContribution == Pole.Positive ? AxisRange.Positive : AxisRange.Negative;

                        OneKeyBinding kb = Instantiate(keyBindingPrefab, bd.transform);
                        kb.HandleListening += HandleListening;
                        kb.RenderKey(playerId, inputAction, axisRange, selectedMap.controllerType, selectedMap, ele);
                        keyBindingList.Add(kb);
                    }
                }
                else
                {
                    DebugHelper.Log("意外的InputActionType");
                }
            }
        }