public void Start() { Get = this; FollowTarget.disableIfInvisible = false; FollowTarget.mUICamera = GUIManager.Get.HudCamera; Prompt1.Clear(); Prompt2.Clear(); }
public override void PushEditObjectToNGUIObject() { MouseSensitivityFPSMax = Globals.MouseSensitivityFPSMax; MouseSensitivityFPSMin = Globals.MouseSensitivityFPSMin; foreach (ActionSetting action in UserActionManager.Get.CurrentActionSettings) { if (action.AxisSetting) { GUIHud.HudPrompt p = new GUIHud.HudPrompt(action.Axis, ActionSetting.InputAxis.None, action.ActionDescription); p = GUIHud.GetBindings(p); UserPrompts.Add(p); } else { GUIHud.HudPrompt p = new GUIHud.HudPrompt((UserActionType)action.Action, action.ActionDescription); p = GUIHud.GetBindings(p); UserPrompts.Add(p); } GameObject miniActionGameObject = NGUITools.AddChild(MovementAndActionsGrid.gameObject, MiniActionPrefab); GUIHudMiniAction miniAction = miniActionGameObject.GetComponent <GUIHudMiniAction> (); //add a box collider so GUI will pick it up miniAction.gameObject.GetOrAdd <BoxCollider> (); UserMiniActions.Add(miniAction); } foreach (ActionSetting action in InterfaceActionManager.Get.CurrentActionSettings) { if (action.AxisSetting) { GUIHud.HudPrompt p = new GUIHud.HudPrompt(ActionSetting.InputAxis.None, action.Axis, action.ActionDescription); p = GUIHud.GetBindings(p); InterfacePrompts.Add(p); } else { GUIHud.HudPrompt p = new GUIHud.HudPrompt((InterfaceActionType)action.Action, action.ActionDescription); p = GUIHud.GetBindings(p); InterfacePrompts.Add(p); } GameObject miniActionGameObject = NGUITools.AddChild(InterfaceGrid.gameObject, MiniActionPrefab); GUIHudMiniAction miniAction = miniActionGameObject.GetComponent <GUIHudMiniAction> (); miniAction.gameObject.GetOrAdd <BoxCollider> (); InterfaceMiniActions.Add(miniAction); } mInitialized = true; Refresh(); ControlsRefresh(); }
public override void PushEditObjectToNGUIObject() { UserActions.Behavior = PassThroughBehavior.PassThrough; Behavior = PassThroughBehavior.PassThrough; //subscribe to the actions if (mEditObject.Prompt1.IsUserAction) { //UserActions.Behavior = PassThroughBehavior.InterceptByFilter; //UserActions.Filter |= mEditObject.Prompt1.UserAction; UserActions.Subscribe(mEditObject.Prompt1.UserAction, new ActionListener(Action1)); } else if (mEditObject.Prompt1.IsInterfaceAction) { //Behavior = PassThroughBehavior.InterceptByFilter; //Filter |= mEditObject.Prompt2.InterfaceAction; Subscribe(mEditObject.Prompt1.InterfaceAction, Action1); } if (mEditObject.Prompt2.IsUserAction) { //UserActions.Behavior = PassThroughBehavior.InterceptByFilter; //UserActions.Filter |= mEditObject.Prompt1.UserAction; UserActions.Subscribe(mEditObject.Prompt2.UserAction, new ActionListener(Action2)); } else if (mEditObject.Prompt2.IsInterfaceAction) { //Behavior = PassThroughBehavior.InterceptByFilter; //Filter |= mEditObject.Prompt2.InterfaceAction; Subscribe(mEditObject.Prompt2.InterfaceAction, Action2); } MessageLabel.text = EditObject.Message; GUIHud.GUIHudMode mode = GUIHud.GUIHudMode.MouseAndKeyboard; if (Profile.Get.CurrentPreferences.Controls.ShowControllerPrompts) { mode = GUIHud.GUIHudMode.Controller; } //get the bindings for the prompts if (EditObject.Prompt1.Visible) { EditObject.Prompt1 = GUIHud.GetBindings(EditObject.Prompt1); GameObject miniAction1GameObject = NGUITools.AddChild(MiniActionParent1, MiniActionPrefab); MiniAction1 = miniAction1GameObject.GetComponent <GUIHudMiniAction>(); EditObject.Prompt1 = GUIHud.RefreshHudAction(EditObject.Prompt1, MiniAction1, mode, false); } if (EditObject.Prompt2.Visible) { EditObject.Prompt2 = GUIHud.GetBindings(EditObject.Prompt2); GameObject miniAction2GameObject = NGUITools.AddChild(MiniActionParent2, MiniActionPrefab); MiniAction2 = miniAction2GameObject.GetComponent <GUIHudMiniAction>(); EditObject.Prompt2 = GUIHud.RefreshHudAction(EditObject.Prompt2, MiniAction2, mode, false); } if (!EditObject.Prompt2.Visible && EditObject.Prompt1.Visible) { //if it's only one && not the other //center the one action if (EditObject.Prompt1.Visible) { Vector3 miniActionPosition = MiniActionParent1.transform.localPosition; miniActionPosition.x = 0f; MiniActionParent1.transform.localPosition = miniActionPosition; } else { Vector3 miniActionPosition = MiniActionParent2.transform.localPosition; miniActionPosition.x = 0f; MiniActionParent2.transform.localPosition = miniActionPosition; } } }
public override void Refresh() { if (Profile.Get.HasControllerPluggedIn) { ControllerPromptsCheckboxLabel.text = "Use Controller Prompts (Controller available)"; } else { ControllerPromptsCheckboxLabel.text = "Use Controller Prompts (No controllers found)"; } GUIHud.GUIHudMode mode = GUIHud.GUIHudMode.MouseAndKeyboard; //ViewAnyTimeLabel.enabled = true; if (ControllerPrompts.isChecked) { mode = GUIHud.GUIHudMode.Controller; //ViewAnyTimeLabel.enabled = false; } for (int i = 0; i < UserPrompts.Count; i++) { UserPrompts [i] = GUIHud.RefreshHudAction(UserPrompts [i], UserMiniActions [i], mode, false); //Debug.Log("Refreshing user prompt " + UserPrompts[i].Description); UserMiniActions [i].gameObject.SetActive(!UserPrompts [i].IsEmpty); } for (int i = 0; i < InterfacePrompts.Count; i++) { InterfacePrompts [i] = GUIHud.RefreshHudAction(InterfacePrompts [i], InterfaceMiniActions [i], mode, false); //Debug.Log("Refreshing interface prompt " + InterfacePrompts[i].Description); InterfaceMiniActions [i].gameObject.SetActive(!InterfacePrompts [i].IsEmpty); } MovementAndActionsGrid.maxPerLine = 7; InterfaceGrid.maxPerLine = 7; MovementAndActionsGrid.hideInactive = true; InterfaceGrid.hideInactive = true; MovementAndActionsGrid.Reposition(); InterfaceGrid.Reposition(); GUIHud.HudPrompt vrp = new GUIHud.HudPrompt(ActionSetting.InputAxis.MouseX, ActionSetting.InputAxis.None, "Rotate Camera"); vrp = GUIHud.GetBindings(vrp, true); vrp = GUIHud.RefreshHudAction(vrp, RotateCameraMouse, mode, false); vrp = new GUIHud.HudPrompt((InterfaceActionType)InterfaceActionType.CursorClick, "Click"); vrp = GUIHud.GetBindings(vrp); vrp = GUIHud.RefreshHudAction(vrp, CursorClick, mode, false); vrp = new GUIHud.HudPrompt((InterfaceActionType)InterfaceActionType.CursorRightClick, "Right-Click"); vrp = GUIHud.GetBindings(vrp); vrp = GUIHud.RefreshHudAction(vrp, CursorRightClick, mode, false); vrp = new GUIHud.HudPrompt(ActionSetting.InputAxis.None, ActionSetting.InputAxis.None, "Button Up"); vrp = GUIHud.GetBindings(vrp, true); vrp = GUIHud.RefreshHudAction(vrp, SelectUp, mode, false); vrp = new GUIHud.HudPrompt(ActionSetting.InputAxis.None, ActionSetting.InputAxis.None, "Button Down"); vrp = GUIHud.GetBindings(vrp, false); vrp = GUIHud.RefreshHudAction(vrp, SelectDown, mode, false); vrp = new GUIHud.HudPrompt(ActionSetting.InputAxis.None, ActionSetting.InputAxis.None, "Button Left"); vrp = GUIHud.GetBindings(vrp, true); vrp = GUIHud.RefreshHudAction(vrp, SelectLeft, mode, false); vrp = new GUIHud.HudPrompt(ActionSetting.InputAxis.None, ActionSetting.InputAxis.None, "Button Right"); vrp = GUIHud.GetBindings(vrp, false); vrp = GUIHud.RefreshHudAction(vrp, SelectRight, mode, false); if (CustomDeadZonesCheckbox.isChecked) { DeadZoneLeftStickUpper.gameObject.SendMessage("SetEnabled"); DeadZoneRightStickUpper.gameObject.SendMessage("SetEnabled"); DeadZoneDPadUpper.gameObject.SendMessage("SetEnabled"); DeadZoneLeftStickLower.gameObject.SendMessage("SetEnabled"); DeadZoneRightStickLower.gameObject.SendMessage("SetEnabled"); DeadZoneDPadLower.gameObject.SendMessage("SetEnabled"); DPadSensitivitySlider.gameObject.SendMessage("SetEnabled"); LeftStickSensitivitySlider.gameObject.SendMessage("SetEnabled"); RightStickSensitivitySlider.gameObject.SendMessage("SetEnabled"); } else { DeadZoneLeftStickUpper.gameObject.SendMessage("SetDisabled"); DeadZoneRightStickUpper.gameObject.SendMessage("SetDisabled"); DeadZoneDPadUpper.gameObject.SendMessage("SetDisabled"); DeadZoneLeftStickLower.gameObject.SendMessage("SetDisabled"); DeadZoneRightStickLower.gameObject.SendMessage("SetDisabled"); DeadZoneDPadLower.gameObject.SendMessage("SetDisabled"); DPadSensitivitySlider.gameObject.SendMessage("SetDisabled"); LeftStickSensitivitySlider.gameObject.SendMessage("SetDisabled"); RightStickSensitivitySlider.gameObject.SendMessage("SetDisabled"); } DeadZoneLeftStickUpperLabel.text = Profile.Get.CurrentPreferences.Controls.DeadZoneLStickUpper.ToString("P1"); DeadZoneRightStickUpperLabel.text = Profile.Get.CurrentPreferences.Controls.DeadZoneRStickUpper.ToString("P1"); DeadZoneDPadUpperLabel.text = Profile.Get.CurrentPreferences.Controls.DeadZoneDPadUpper.ToString("P1"); DeadZoneLeftStickLowerLabel.text = Profile.Get.CurrentPreferences.Controls.DeadZoneLStickLower.ToString("P1"); DeadZoneRightStickLowerLabel.text = Profile.Get.CurrentPreferences.Controls.DeadZoneRStickLower.ToString("P1"); DeadZoneDPadLowerLabel.text = Profile.Get.CurrentPreferences.Controls.DeadZoneDPadLower.ToString("P1"); DPadSensitivitySliderLabel.text = Profile.Get.CurrentPreferences.Controls.SensitivityDPad.ToString("P1"); LeftStickSensitivitySliderLabel.text = Profile.Get.CurrentPreferences.Controls.SensitivityLStick.ToString("P1"); RightStickSensitivitySliderLabel.text = Profile.Get.CurrentPreferences.Controls.SensitivityRStick.ToString("P1"); mRefreshingControls = true; DeadZoneLeftStickUpper.sliderValue = Profile.Get.CurrentPreferences.Controls.DeadZoneLStickUpper; DeadZoneRightStickUpper.sliderValue = Profile.Get.CurrentPreferences.Controls.DeadZoneRStickUpper; DeadZoneDPadUpper.sliderValue = Profile.Get.CurrentPreferences.Controls.DeadZoneDPadUpper; DeadZoneLeftStickLower.sliderValue = Profile.Get.CurrentPreferences.Controls.DeadZoneLStickLower; DeadZoneRightStickLower.sliderValue = Profile.Get.CurrentPreferences.Controls.DeadZoneRStickLower; DeadZoneDPadLower.sliderValue = Profile.Get.CurrentPreferences.Controls.DeadZoneDPadLower; DPadSensitivitySlider.sliderValue = Profile.Get.CurrentPreferences.Controls.SensitivityDPad; LeftStickSensitivitySlider.sliderValue = Profile.Get.CurrentPreferences.Controls.SensitivityLStick; RightStickSensitivitySlider.sliderValue = Profile.Get.CurrentPreferences.Controls.SensitivityRStick; mRefreshingControls = false; }