public Player(Texture2D cursor, Point size, Texture2D[] statusBar, ContentManager cm) : base() { #if DEBUG buildingID = "Nan"; #endif sub_m = Sub_Player_Modes.Display_FHB; persistance = (float)(Statistics.TotalEnergyGained / 1000000); persistance = persistance * 0.03f; mode = Player_Modes.MainMenu; controls = new ControlMapper("Content/settings/controls.txt"); this.cursor = new Cursor(cm.Load <Texture2D>("texture/cursor_sheet"), new Dictionary <string, Vector3>() { { "M_Build", new Vector3(0, 1, 500) }, { "M_Research", new Vector3(2, 7, 100) }, { "M_Spells", new Vector3(8, 13, 200) }, { "M_Tools", new Vector3(14, 17, 150) }, { "M_Pause", new Vector3(18, 26, 300) } }); this.energy = 2000; max_energy = this.energy; status_bar = new StatusBar(size, energy, statusBar, new Text(Vector2.One, "", Color.White)); status_bar.UpdatePosition(new Vector2(10, 850)); text = new Text(status_bar.Position + status_bar.GetText.Position + new Vector2(128, -22), "", Color.White); status_bar.GetText.Colour = Color.DarkSlateGray; populationDisplay = new KeyValuePair <Text, Text>(new Text(Vector2.Zero, "Zombies: ", Color.DarkKhaki), new Text(Vector2.Zero, "", Color.White)); pop_changed = false; }
public IHttpActionResult Get(int id) { #region Preconditions if (controlRepository == null) { throw new InvalidOperationException(); } if (id <= 0) { throw new ArgumentOutOfRangeException(); } #endregion try { var control = controlRepository.GetItem(id); var dtoControl = ControlMapper.TranslateModelControlToDTOControl(control); return(Ok(dtoControl)); } catch (Exception) { return(InternalServerError()); } }
private string GetViewEdit() { var sb = new StringBuilder(); Process(sb, "\n public " + ClassType.Name + " Item;\n", b => { b.h1.text(ClassType.Name + " Edit").end.enter().enter(); b.form("post", "<%= UrlTo.Action(\"update\").Parameters(Item.Id) %>").enter(); var ctx = ModelContext.GetInstance(ClassType); foreach (MemberHandler m in ctx.Info.Members) { if (!m.Is.RelationField && !m.Is.DbGenerate && !m.Is.AutoSavedValue) { string n = ClassType.Name.ToLower() + "_" + m.Name.ToLower(); string n1 = ClassType.Name.ToLower() + "[" + m.Name.ToLower() + "]"; b.include(" ").p.label.attr("for", n).text(m.Name).end.br .include(ControlMapper.Map(m, n, n1, "<%= Item." + m.Name + " %>")).end.enter(); } } b.input.name("commit").type("submit").value("Update").end.enter().end.enter().enter(); b.include("<%= LinkTo.Title(\"Show\").Action(\"show\").Parameters(Item.Id) %>").enter(); b.include("<%= LinkTo.Title(\"Back\").Action(\"list\") %>").enter(); }); return(sb.ToString()); }
protected virtual void SinglePixelRLEvaluateStep() { SchoolWorld.ActionInput.SafeCopyToHost(); bool wasTargetDetected = SchoolWorld.ActionInput.Host[ControlMapper.Idx("forward")] != 0; bool wasTargetPresent = m_previousObjectType == ObjectType.Target; if (wasTargetDetected && wasTargetPresent) { m_targetsDetected++; WrappedWorld.Reward.Host[0] = 1f; } else if (m_previousObjectType != ObjectType.None) { if (wasTargetDetected && !wasTargetPresent) { m_targetsMisdetected++; WrappedWorld.Reward.Host[0] = -1f; } else if (wasTargetPresent && !wasTargetDetected) { WrappedWorld.Reward.Host[0] = -1f; } else { WrappedWorld.Reward.Host[0] = 0f; } } else { WrappedWorld.Reward.Host[0] = 0; } }
private void LoadSelectedConfiguration() { LoadedConfiguration = ControlMapper.LoadConfigurationFromFile(Path.Combine(Sys.PathToControlsFolder, InGameConfigurationMap[SelectedGameConfigOption])); UpdateAllButtonText(); UpdateAllButtonIcons(); HasUnsavedChanges = false; }
/// <summary> /// Removes handlers to events of a current business object property. /// It is essential that if the AddCurrentBoPropHandlers is implemented then this /// is implemented such that editing a business object that is no longer being shown on the control does not /// does not update the value in the control. /// </summary> /// <param name="mapper">The control mapper that maps the business object property to the control</param> /// <param name="boProp">The business object property being mapped to the control</param> public void RemoveCurrentBOPropHandlers(ControlMapper mapper, IBOProp boProp) { if (boProp != null) { boProp.Updated -= mapper.BOPropValueUpdatedHandler; } }
public static DTO.Task TranslateModelUserTaskToDTOTask(Model.UserTask ut) { if (ut == null) { return(null); } return(new DTO.Task { Code = ut.Code, Comments = Mapper.TranslateModelCommentListToDTOCommentList(ut.Comments), Completed = ut.Completed, Control = ControlMapper.TranslateModelControlToDTOControl(ut.Control), ControlId = ut.ControlId, ControlCode = ut.ControlCode, ControlSetCode = ut.ControlSetCode, ControlSetId = ut.ControlSetId, ControlSetTitle = ut.ControlSetTitle, ControlTitle = ut.ControlTitle, Created = ut.Created, CreatedByUserId = ut.CreatedByUserId, Description = ut.Description, Due = ut.Due, DueStatus = Mapper.TranslateModelDueStatusToDTODueStatus(ut.DueStatus), Events = Mapper.TranslateModelEventListToDTOEventList(ut.Events), Id = ut.Id, Link = ut.Link, RaciTeam = Mapper.TranslateModelRaciTeamToDTORaciTeam(ut.RaciTeam), TaskDefinitionId = ut.TaskDefinitionId, TaskState = Mapper.TranslateModelTaskStateToDTOTaskState(ut.TaskState), Title = ut.Title, WorkingSet = WorkingSetMapper.TranslateModelWorkingSetToDTOWorkingSet(ut.WorkingSet), WorkingSetId = ut.WorkingSetId }); }
public override void Initialize(int id, System.Func <int, bool> isFocusedCallback) { if ( spawnTransform == null || doneButton == null || cancelButton == null || defaultButton == null || uiControlSetPrefab == null || uiSliderControlPrefab == null || doneButtonLabel == null || cancelButtonLabel == null || defaultButtonLabel == null ) { Debug.LogError("Rewired Control Mapper: All inspector values must be assigned!"); return; } inputBehaviorInfo = new List <InputBehaviorInfo>(); buttonCallbacks = new Dictionary <int, System.Action <int> >(); // Set static element labels doneButtonLabel.text = ControlMapper.GetLanguage().done; cancelButtonLabel.text = ControlMapper.GetLanguage().cancel; defaultButtonLabel.text = ControlMapper.GetLanguage().default_; base.Initialize(id, isFocusedCallback); }
/// <summary> /// Adds handlers to events of a current business object property. /// </summary> /// <param name="mapper">The control mapper that maps the business object property to the control</param> /// <param name="boProp">The business object property being mapped to the control</param> public void AddCurrentBOPropHandlers(ControlMapper mapper, IBOProp boProp) { if (boProp != null) { // Add needed handlers boProp.Updated += mapper.BOPropValueUpdatedHandler; } }
private IControlMapper AddControlMapper(Type controlMapperType, IControlHabanero controlHabanero, string propName) { var controlMapper = ControlMapper.Create(controlMapperType, controlHabanero, propName, false, GlobalUIRegistry.ControlFactory); return(AddMapper(controlMapper)); }
public void MapWorldInputs() { // Copy data from wrapper to world (inputs) - SchoolWorld validation ensures that we have something connected School.ActionInput.SafeCopyToHost(); ControlsAdapterTemp.Host[0] = School.ActionInput.Host[ControlMapper.Idx("left")]; // A ControlsAdapterTemp.Host[1] = School.ActionInput.Host[ControlMapper.Idx("backward")]; // S ControlsAdapterTemp.Host[2] = School.ActionInput.Host[ControlMapper.Idx("right")]; // D ControlsAdapterTemp.SafeCopyToDevice(); }
public ControlService(HigoContext higoContext, ControlMapper controlMapper, IOperacionService operacionService, ControlResponseBuilder controlResponseBuilder, ControlUtils controlUtils) { this.higoContext = higoContext; this.controlMapper = controlMapper; this.operacionService = operacionService; this.controlResponseBuilder = controlResponseBuilder; this.controlUtils = controlUtils; }
public void EvaluateSinglePixelRLStep() { SchoolWorld.ActionInput.SafeCopyToHost(); int action = 0; if (SchoolWorld.ActionInput.Host[ControlMapper.Idx("forward")] != 0) { action = 1; } else if (SchoolWorld.ActionInput.Host[ControlMapper.Idx("backward")] != 0) { action = 2; } else if (SchoolWorld.ActionInput.Host[ControlMapper.Idx("left")] != 0) { action = 3; } else if (SchoolWorld.ActionInput.Host[ControlMapper.Idx("right")] != 0) { action = 4; } int expectedAction = 0; if (m_lastTransition != null) { expectedAction = m_lastTransition.action; //MyLog.WARNING.WriteLine("Action taken: " + action+" expected action: "+expectedAction); } if (m_lastTransition == null) { m_stepIsCorrect = true; WrappedWorld.Reward.Host[0] = 0f; } else if (action == expectedAction) { m_stepIsCorrect = true; if (m_importantActions.Contains(action)) { m_importantActionsTaken++; WrappedWorld.Reward.Host[0] = 1f; } else { WrappedWorld.Reward.Host[0] = 0f; } } else { m_stepIsCorrect = false; WrappedWorld.Reward.Host[0] = -1f; } }
// Use this for enter state public override void OnStateBegin() { ControlMapper controlMapper = m_ControlMapper.value as ControlMapper; if (controlMapper == null) { return; } controlMapper.Close(m_SaveOnClose.value); }
internal void SaveChangesToFile() { try { ControlMapper.SaveConfigurationToFile(Path.Combine(Sys.PathToControlsFolder, InGameConfigurationMap[SelectedGameConfigOption]), LoadedConfiguration); HasUnsavedChanges = false; } catch (Exception e) { Logger.Error(e); //StatusMessage = $"{ResourceHelper.Get(StringKey.FailedToDeleteCustomControls)}: {e.Message}"; } }
public override void Execute() { // Process FOF controls Owner.ActionInput.SafeCopyToHost(); float fof_up = Owner.ActionInput.Host[ControlMapper.Idx("fof_up")]; // I float fof_left = Owner.ActionInput.Host[ControlMapper.Idx("fof_left")]; // J float fof_down = Owner.ActionInput.Host[ControlMapper.Idx("fof_down")]; // K float fof_right = Owner.ActionInput.Host[ControlMapper.Idx("fof_right")]; // L FofX = ConvertBiControlToUniControl(fof_left, fof_right); FofY = ConvertBiControlToUniControl(fof_down, fof_up); Owner.CurrentWorld.MapWorldInputs(); }
public override void Initialize(int id, Func <int, bool> isFocusedCallback) { if (this.spawnTransform == null || this.doneButton == null || this.cancelButton == null || this.defaultButton == null || this.uiControlSetPrefab == null || this.uiSliderControlPrefab == null || this.doneButtonLabel == null || this.cancelButtonLabel == null || this.defaultButtonLabel == null) { Debug.LogError("Rewired Control Mapper: All inspector values must be assigned!"); return; } this.inputBehaviorInfo = new List <InputBehaviorWindow.InputBehaviorInfo>(); this.buttonCallbacks = new Dictionary <int, Action <int> >(); this.doneButtonLabel.text = ControlMapper.GetLanguage().done; this.cancelButtonLabel.text = ControlMapper.GetLanguage().cancel; this.defaultButtonLabel.text = ControlMapper.GetLanguage().default_; base.Initialize(id, isFocusedCallback); }
private void UpdateControls() { taskIdMap.Clear(); if (ControlModeHidden == ControlMapper.ControlMode.SimpleTaskSpecific && Curriculum != null) { int lowestFreeTaskId = 0; foreach (ILearningTask learningTask in Curriculum) { if (!taskIdMap.ContainsKey(learningTask.GetType())) { taskIdMap[learningTask.GetType()] = lowestFreeTaskId; ControlMapper.CreateControlsFor(lowestFreeTaskId++); } } } }
// Use this for enter state public override void OnStateBegin() { m_CachedControlMapper = m_ControlMapper.value as ControlMapper; if (m_CachedControlMapper == null) { return; } m_CachedCloseOnEnd = m_CloseOnEnd.value; m_CachedSaveOnEnd = m_SaveOnEnd.value; m_CachedControlMapper.Open(); m_CachedControlMapper.onScreenClosed += OnScreenClosed; m_AddedListerOnScreenClosed = true; }
protected override bool DidTrainingUnitComplete(ref bool wasUnitSuccessful) { int correction = m_currentObjectType == ObjectType.Target ? 1 : 0; wasUnitSuccessful = (m_targetsShown - correction == m_targetsDetected && m_targetsMisdetected == 0); bool acted = SchoolWorld.ActionInput.Host[ControlMapper.Idx("forward")] != 0; MyLog.Writer.WriteLine(MyLogLevel.WARNING, "did act: " + acted + ", wasTarget: " + (m_previousObjectType == ObjectType.Target) + ", was allowed to act: " + m_previousTargetWithAction); MyLog.Writer.WriteLine(MyLogLevel.WARNING, "m_targetsShown:" + m_targetsShown + ", m_targetsDetected: " + m_targetsDetected + "correction: " + correction + ", targetsMisdetected: " + m_targetsMisdetected); return(m_targetsShown - correction == m_targetsPerTU); // - correction, because when ending, ExecuteStep is done before the last EvaluateStep - the ExecuteStep may prepare a new state which should be ignored by EvaluateStep }
void GetButtonInput() { button = GameButton.None; if (ControlMapper.GetButton(playerNumber, GameButton.LightAttack)) { button = GameButton.LightAttack; } if (ControlMapper.GetButton(playerNumber, GameButton.MediumAttack)) { button = GameButton.MediumAttack; } if (ControlMapper.GetButton(playerNumber, GameButton.HeavyAttack)) { button = GameButton.HeavyAttack; } }
public override void Initialize(int id, System.Func <int, bool> isFocusedCallback) { if ( rightContentContainer == null || valueDisplayGroup == null || calibratedValueMarker == null || rawValueMarker == null || calibratedZeroMarker == null || deadzoneArea == null || deadzoneSlider == null || sensitivitySlider == null || zeroSlider == null || invertToggle == null || axisScrollAreaContent == null || doneButton == null || calibrateButton == null || axisButtonPrefab == null || doneButtonLabel == null || cancelButtonLabel == null || defaultButtonLabel == null || deadzoneSliderLabel == null || zeroSliderLabel == null || sensitivitySliderLabel == null || invertToggleLabel == null || calibrateButtonLabel == null ) { Debug.LogError("Rewired Control Mapper: All inspector values must be assigned!"); return; } axisButtons = new List <Button>(); buttonCallbacks = new Dictionary <int, System.Action <int> >(); // Set static element labels doneButtonLabel.text = ControlMapper.GetLanguage().done; cancelButtonLabel.text = ControlMapper.GetLanguage().cancel; defaultButtonLabel.text = ControlMapper.GetLanguage().default_; deadzoneSliderLabel.text = ControlMapper.GetLanguage().calibrateWindow_deadZoneSliderLabel; zeroSliderLabel.text = ControlMapper.GetLanguage().calibrateWindow_zeroSliderLabel; sensitivitySliderLabel.text = ControlMapper.GetLanguage().calibrateWindow_sensitivitySliderLabel; invertToggleLabel.text = ControlMapper.GetLanguage().calibrateWindow_invertToggleLabel; calibrateButtonLabel.text = ControlMapper.GetLanguage().calibrateWindow_calibrateButtonLabel; base.Initialize(id, isFocusedCallback); }
private void Awake() { if (instance == null) { instance = this; foreach (Control c in player1ControlsArray) { player1Mapping[c.name] = c; } foreach (Control c in player2ControlsArray) { player2Mapping[c.name] = c; } } }
public void SetData(int playerId, ControlMapper.InputBehaviorSettings[] data) { if (!base.initialized) { return; } this.playerId = playerId; for (int i = 0; i < data.Length; i++) { ControlMapper.InputBehaviorSettings inputBehaviorSettings = data[i]; if (inputBehaviorSettings != null && inputBehaviorSettings.isValid) { InputBehavior inputBehavior = this.GetInputBehavior(inputBehaviorSettings.inputBehaviorId); if (inputBehavior != null) { UIControlSet uIControlSet = this.CreateControlSet(); Dictionary <int, InputBehaviorWindow.PropertyType> dictionary = new Dictionary <int, InputBehaviorWindow.PropertyType>(); string customEntry = ControlMapper.GetLanguage().GetCustomEntry(inputBehaviorSettings.labelLanguageKey); if (!string.IsNullOrEmpty(customEntry)) { uIControlSet.SetTitle(customEntry); } else { uIControlSet.SetTitle(inputBehavior.name); } if (inputBehaviorSettings.showJoystickAxisSensitivity) { UISliderControl uISliderControl = this.CreateSlider(uIControlSet, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(inputBehaviorSettings.joystickAxisSensitivityLabelLanguageKey), inputBehaviorSettings.joystickAxisSensitivityIcon, inputBehaviorSettings.joystickAxisSensitivityMin, inputBehaviorSettings.joystickAxisSensitivityMax, new Action <int, int, float>(this.JoystickAxisSensitivityValueChanged), new Action <int, int>(this.JoystickAxisSensitivityCanceled)); uISliderControl.slider.value = Mathf.Clamp(inputBehavior.joystickAxisSensitivity, inputBehaviorSettings.joystickAxisSensitivityMin, inputBehaviorSettings.joystickAxisSensitivityMax); dictionary.Add(uISliderControl.id, InputBehaviorWindow.PropertyType.JoystickAxisSensitivity); } if (inputBehaviorSettings.showMouseXYAxisSensitivity) { UISliderControl uISliderControl2 = this.CreateSlider(uIControlSet, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(inputBehaviorSettings.mouseXYAxisSensitivityLabelLanguageKey), inputBehaviorSettings.mouseXYAxisSensitivityIcon, inputBehaviorSettings.mouseXYAxisSensitivityMin, inputBehaviorSettings.mouseXYAxisSensitivityMax, new Action <int, int, float>(this.MouseXYAxisSensitivityValueChanged), new Action <int, int>(this.MouseXYAxisSensitivityCanceled)); uISliderControl2.slider.value = Mathf.Clamp(inputBehavior.mouseXYAxisSensitivity, inputBehaviorSettings.mouseXYAxisSensitivityMin, inputBehaviorSettings.mouseXYAxisSensitivityMax); dictionary.Add(uISliderControl2.id, InputBehaviorWindow.PropertyType.MouseXYAxisSensitivity); } this.inputBehaviorInfo.Add(new InputBehaviorWindow.InputBehaviorInfo(inputBehavior, uIControlSet, dictionary)); } } } base.defaultUIElement = this.doneButton.gameObject; }
public override void Initialize(int id, Func <int, bool> isFocusedCallback) { if (this.rightContentContainer == null || this.valueDisplayGroup == null || this.calibratedValueMarker == null || this.rawValueMarker == null || this.calibratedZeroMarker == null || this.deadzoneArea == null || this.deadzoneSlider == null || this.sensitivitySlider == null || this.zeroSlider == null || this.invertToggle == null || this.axisScrollAreaContent == null || this.doneButton == null || this.calibrateButton == null || this.axisButtonPrefab == null || this.doneButtonLabel == null || this.cancelButtonLabel == null || this.defaultButtonLabel == null || this.deadzoneSliderLabel == null || this.zeroSliderLabel == null || this.sensitivitySliderLabel == null || this.invertToggleLabel == null || this.calibrateButtonLabel == null) { Debug.LogError("Rewired Control Mapper: All inspector values must be assigned!"); return; } this.axisButtons = new List <Button>(); this.buttonCallbacks = new Dictionary <int, Action <int> >(); this.doneButtonLabel.text = ControlMapper.GetLanguage().done; this.cancelButtonLabel.text = ControlMapper.GetLanguage().cancel; this.defaultButtonLabel.text = ControlMapper.GetLanguage().default_; this.deadzoneSliderLabel.text = ControlMapper.GetLanguage().calibrateWindow_deadZoneSliderLabel; this.zeroSliderLabel.text = ControlMapper.GetLanguage().calibrateWindow_zeroSliderLabel; this.sensitivitySliderLabel.text = ControlMapper.GetLanguage().calibrateWindow_sensitivitySliderLabel; this.invertToggleLabel.text = ControlMapper.GetLanguage().calibrateWindow_invertToggleLabel; this.calibrateButtonLabel.text = ControlMapper.GetLanguage().calibrateWindow_calibrateButtonLabel; base.Initialize(id, isFocusedCallback); }
public void Test_AutoLoadingMapper_WhenCreateFromControlMapper_ShouldSetupCollection() { //---------------Set up test pack------------------- var cmbox = _controlFactory.CreateComboBox(); var controlMapper = ControlMapper.Create ("AutoLoadingRelationshipComboBoxMapper", "Habanero.Faces.Base", cmbox, "ContactPersonTestBO", false, GetControlFactory()); var person1 = ContactPersonTestBO.CreateSavedContactPerson(); var person2 = ContactPersonTestBO.CreateSavedContactPerson(); var addressTestBo = new AddressTestBO(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- controlMapper.BusinessObject = addressTestBo; //---------------Test Result ----------------------- Assert.AreEqual(3, cmbox.Items.Count); Assert.IsTrue(cmbox.Items.Contains(person1)); Assert.IsTrue(cmbox.Items.Contains(person2)); }
public IHttpActionResult Get() { #region Preconditions if (controlRepository == null) { throw new InvalidOperationException(); } #endregion try { var controls = controlRepository.GetItems(); var dtoControls = controls.Select(cs => ControlMapper.TranslateModelControlToDTOControl(cs)); return(Ok(dtoControls)); } catch (Exception) { return(InternalServerError()); } }
static Game() { GameObject game = SafeFind("_app"); m_setManager = (PersistentSetManager)SafeComponent(game, "PersistentSetManager"); m_options = (OptionManager)SafeComponent(game, "OptionManager"); m_languages = (LanguageManager)SafeComponent(game, "LanguageManager"); m_audio = (AudioManager)SafeComponent(game, "AudioManager"); m_projPool = (ProjectilePooler)SafeComponent(SafeFind("ProjectilePooler"), "ProjectilePooler"); m_npcGenerator = (NPCGenerator)SafeComponent(game, "NPCGenerator"); m_enemyGenerator = (EnemyGenerator)SafeComponent(game, "EnemyGenerator"); m_rewiredEventSystem = (RewiredStandaloneInputModule)SafeComponent(SafeFind("Rewired Event System"), "RewiredStandaloneInputModule"); m_controlMapper = (ControlMapper)SafeComponent(SafeFind("ControlMapper"), "ControlMapper"); m_controlMapperMenu = (Menu)SafeComponent(SafeFind("Canvas"), "Menu"); ProjectileBehaviour.LoadAll(); ShotPattern.LoadAll(); BaseItem.LoadAll(); Ability.LoadAll(); Skill.LoadAll(); State.LoadAll(); m_controlMapperMenu.gameObject.SetActive(false); }
public void SetData(int playerId, ControlMapper.InputBehaviorSettings[] data) { if (!initialized) { return; } this.playerId = playerId; // Create control sets for (int i = 0; i < data.Length; i++) { var item = data[i]; if (item == null || !item.isValid) { continue; } InputBehavior inputBehavior = GetInputBehavior(item.inputBehaviorId); if (inputBehavior == null) { continue; } UIControlSet set = CreateControlSet(); Dictionary <int, PropertyType> idToProperty = new Dictionary <int, PropertyType>();; // Set the title string customTitle = ControlMapper.GetLanguage().GetCustomEntry(item.labelLanguageKey); if (!string.IsNullOrEmpty(customTitle)) { set.SetTitle(customTitle); } else { set.SetTitle(inputBehavior.name); } // Create sliders if (item.showJoystickAxisSensitivity) { UISliderControl slider = CreateSlider( set, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(item.joystickAxisSensitivityLabelLanguageKey), item.joystickAxisSensitivityIcon, item.joystickAxisSensitivityMin, item.joystickAxisSensitivityMax, JoystickAxisSensitivityValueChanged, JoystickAxisSensitivityCanceled ); // Set initial value slider.slider.value = Mathf.Clamp(inputBehavior.joystickAxisSensitivity, item.joystickAxisSensitivityMin, item.joystickAxisSensitivityMax); // Store property type idToProperty.Add(slider.id, PropertyType.JoystickAxisSensitivity); } if (item.showMouseXYAxisSensitivity) { UISliderControl slider = CreateSlider( set, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(item.mouseXYAxisSensitivityLabelLanguageKey), item.mouseXYAxisSensitivityIcon, item.mouseXYAxisSensitivityMin, item.mouseXYAxisSensitivityMax, MouseXYAxisSensitivityValueChanged, MouseXYAxisSensitivityCanceled ); // Set initial value slider.slider.value = Mathf.Clamp(inputBehavior.mouseXYAxisSensitivity, item.mouseXYAxisSensitivityMin, item.mouseXYAxisSensitivityMax); // Store property type idToProperty.Add(slider.id, PropertyType.MouseXYAxisSensitivity); } // mouseOtherAxisSensitivity not implemented // Add to the list inputBehaviorInfo.Add(new InputBehaviorInfo(inputBehavior, set, idToProperty)); } // Set default UI element defaultUIElement = doneButton.gameObject; }
// Token: 0x06003142 RID: 12610 RVA: 0x00015BEE File Offset: 0x00013DEE private void Start() { ControlMapper.ApplyTheme(this._elements); }
public void SetData(int playerId, ControlMapper.InputBehaviorSettings[] data) { if(!initialized) return; this.playerId = playerId; // Create control sets for(int i = 0; i < data.Length; i++) { var item = data[i]; if(item == null || !item.isValid) continue; InputBehavior inputBehavior = GetInputBehavior(item.inputBehaviorId); if(inputBehavior == null) continue; UIControlSet set = CreateControlSet(); Dictionary<int, PropertyType> idToProperty = new Dictionary<int, PropertyType>(); ; // Set the title string customTitle = ControlMapper.GetLanguage().GetCustomEntry(item.labelLanguageKey); if(!string.IsNullOrEmpty(customTitle)) set.SetTitle(customTitle); else set.SetTitle(inputBehavior.name); // Create sliders if(item.showJoystickAxisSensitivity) { UISliderControl slider = CreateSlider( set, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(item.joystickAxisSensitivityLabelLanguageKey), item.joystickAxisSensitivityIcon, item.joystickAxisSensitivityMin, item.joystickAxisSensitivityMax, JoystickAxisSensitivityValueChanged, JoystickAxisSensitivityCanceled ); // Set initial value slider.slider.value = Mathf.Clamp(inputBehavior.joystickAxisSensitivity, item.joystickAxisSensitivityMin, item.joystickAxisSensitivityMax); // Store property type idToProperty.Add(slider.id, PropertyType.JoystickAxisSensitivity); } if(item.showMouseXYAxisSensitivity) { UISliderControl slider = CreateSlider( set, inputBehavior.id, null, ControlMapper.GetLanguage().GetCustomEntry(item.mouseXYAxisSensitivityLabelLanguageKey), item.mouseXYAxisSensitivityIcon, item.mouseXYAxisSensitivityMin, item.mouseXYAxisSensitivityMax, MouseXYAxisSensitivityValueChanged, MouseXYAxisSensitivityCanceled ); // Set initial value slider.slider.value = Mathf.Clamp(inputBehavior.mouseXYAxisSensitivity, item.mouseXYAxisSensitivityMin, item.mouseXYAxisSensitivityMax); // Store property type idToProperty.Add(slider.id, PropertyType.MouseXYAxisSensitivity); } // mouseOtherAxisSensitivity not implemented // Add to the list inputBehaviorInfo.Add(new InputBehaviorInfo(inputBehavior, set, idToProperty)); } // Set default UI element defaultUIElement = doneButton.gameObject; }