// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { SuperTouchZone newObj = (SuperTouchZone)this.CreateNonDynamicTouchControl(typeof(SuperTouchZone)); newObj.maxFingers = 1; for (int i = 0; i < this.fingerBinding.Length; ++i) { if (this.fingerBinding[i].gestureBinding.enabled) // || this.fingerBinding[i].swipeJoyBinding.enabled) { newObj.maxFingers = i + 1; } this.fingerBinding[i].CopyTo(newObj.multiFingerConfigs[i]); } if (this.createSpriteAnimator) { TouchControlWizardUtils.CreateSuperTouchZoneAnimator(newObj, "-Sprite", this.defaultSprite, 1.0f); } Undo.RegisterCreatedObjectUndo(newObj.gameObject, "Create CF2 SuperTouchZone"); if (selectAfterwards) { Selection.activeObject = newObj; } }
// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { TouchJoystick newObj = (TouchJoystick)this.CreateDynamicTouchControl(typeof(ControlFreak2.TouchJoystick)); newObj.stickyMode = true; newObj.pressBinding.CopyFrom(this.pressBinding); //newObj.joyNameBinding.CopyFrom(this.joyNameBinding); newObj.joyStateBinding.horzAxisBinding.CopyFrom(this.horzAxisBinding); newObj.joyStateBinding.vertAxisBinding.CopyFrom(this.vertAxisBinding); if (this.animatorStyle == AnimatorStyle.Simple) { TouchControlWizardUtils.CreateTouchJoystickSimpleAnimator(newObj, "-Sprite", this.defaultSprite, 1.0f, 0.0f); } else { TouchControlWizardUtils.CreateTouchJoystickAnalogAnimators(newObj, this.baseSprite, this.hatSprite, this.hatScale); } Undo.RegisterCreatedObjectUndo(newObj.gameObject, "Create CF2 Joystick"); if (selectAfterwards) { Selection.activeObject = newObj; } }
// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { ControlFreak2.TouchSteeringWheel newObj = (ControlFreak2.TouchSteeringWheel) this.CreateDynamicTouchControl(typeof(ControlFreak2.TouchSteeringWheel)); newObj.wheelMode = TouchSteeringWheel.WheelMode.Turn; newObj.analogConfig.analogDeadZone = 0; newObj.centerOnDirectTouch = false; newObj.centerWhenFollowing = false; newObj.centerOnIndirectTouch = false; newObj.pressBinding.CopyFrom(this.pressBinding); newObj.touchPressureBinding.CopyFrom(this.touchPressureBinding); if (this.touchPressureBinding.enabled) { newObj.emulateTouchPressure = this.emulateTouchPressure; } newObj.analogTurnBinding.CopyFrom(this.turnBinding); newObj.turnRightBinding.CopyFrom(this.turnRightBinding); newObj.turnLeftBinding.CopyFrom(this.turnLeftBinding); TouchControlWizardUtils.CreateWheelAnimator(newObj, "-Sprite", this.defaultSprite, 1.0f); Undo.RegisterCreatedObjectUndo(newObj.gameObject, "Create CF2 Wheel"); if (selectAfterwards) { Selection.activeObject = newObj; } }
// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { TouchTrackPad newObj = (TouchTrackPad)this.CreateNonDynamicTouchControl(typeof(TouchTrackPad)); newObj.pressBinding.CopyFrom(this.pressBinding); newObj.touchPressureBinding.CopyFrom(this.touchPressureBinding); if (this.touchPressureBinding.enabled) { newObj.emulateTouchPressure = this.emulateTouchPressure; } newObj.horzSwipeBinding.CopyFrom(this.horzDeltaBinding); newObj.vertSwipeBinding.CopyFrom(this.vertDeltaBinding); if (this.createSpriteAnimator) { TouchControlWizardUtils.CreateTouchTrackPadAnimator(newObj, "-Sprite", this.defaultSprite, 1.0f); } Undo.RegisterCreatedObjectUndo(newObj.gameObject, "Create CF2 Trackpad"); if (selectAfterwards) { Selection.activeObject = newObj; } }
// ------------------ protected void Init(TouchControlPanel panel, BindingSetup bindingSetup, System.Action onCreationCallback) { base.Init(panel, onCreationCallback); if (bindingSetup != null) { bindingSetup.Apply(this); } this.controlName = TouchControlWizardUtils.GetUniqueButtonName(panel.rig); this.defaultControlName = this.controlName; string uniqueNameSuffix = ""; if ((bindingSetup != null) && !string.IsNullOrEmpty(bindingSetup.pressAxis)) { uniqueNameSuffix = bindingSetup.pressAxis; } else if ((bindingSetup != null) && !string.IsNullOrEmpty(bindingSetup.toggleAxis)) { uniqueNameSuffix = bindingSetup.toggleAxis; } if (!string.IsNullOrEmpty(uniqueNameSuffix)) { this.controlName = (uniqueNameSuffix + "-Button"); } this.defaultSprite = TouchControlWizardUtils.GetDefaultButtonSprite(uniqueNameSuffix); }
// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { ControlFreak2.TouchButton button = (ControlFreak2.TouchButton) this.CreateDynamicTouchControl(typeof(ControlFreak2.TouchButton)); TouchControlWizardUtils.CreateButtonAnimator(button, "-Sprite", this.defaultSprite, 1.0f); if (this.pressBinding.enabled) { button.pressBinding.CopyFrom(this.pressBinding); } if (this.toggleBinding.enabled) { button.toggle = true; button.toggleOnlyBinding.CopyFrom(this.toggleBinding); } Undo.RegisterCreatedObjectUndo(button.gameObject, "Create Touch Button"); if (selectAfterwards) { Selection.activeObject = button; } }
// ------------------ protected void InitWizard(TouchControlPanel panel, System.Action onCreationCallback) { base.Init(panel, onCreationCallback); this.controlName = TouchControlWizardUtils.GetUniqueTouchSplitterName(this.panel.rig); this.defaultControlName = this.controlName; this.controlDepth = 60; this.regionDepth = 60; this.positionMode = NonDynamicControlWizardBase.PositionMode.ConstantSize; }
// ------------------ protected void Init(TouchControlPanel panel, BindingSetup bindingSetup, System.Action onCreationCallback) { base.Init(panel, onCreationCallback); this.controlName = TouchControlWizardUtils.GetUniqueWheelName(this.panel.rig); this.defaultControlName = this.controlName; this.dynamicMode = ControlMode.DynamicWithRegion; this.regionRect = RegionRectPreset.LeftHalf; this.defaultSprite = TouchControlWizardUtils.GetDefaultWheelSprite(); if (bindingSetup != null) { bindingSetup.Apply(this); } }
// ------------------ protected void Init(TouchControlPanel panel, BindingSetup bindignSetup, System.Action onCreationCallback) { base.Init(panel, onCreationCallback); this.controlName = TouchControlWizardUtils.GetUniqueTrackPadName(this.panel.rig); this.defaultControlName = this.controlName; this.defaultSprite = TouchControlWizardUtils.GetDefaultTrackPadSprite(); this.controlShape = TouchControl.Shape.Rectangle; this.positionMode = PositionMode.Stretch; this.regionRect = RegionRectPreset.RightHalf; if (bindignSetup != null) { bindignSetup.Apply(this); } }
// ------------------ protected void Init(TouchControlPanel panel, BindingSetup bindingSetup, System.Action onCreationCallback) { base.Init(panel, onCreationCallback); this.positionMode = NonDynamicControlWizardBase.PositionMode.Stretch; this.controlName = TouchControlWizardUtils.GetUniqueTouchZoneName(panel.rig); this.defaultControlName = this.controlName; this.defaultSprite = TouchControlWizardUtils.GetDefaultSuperTouchZoneSprite(); this.controlShape = TouchControl.Shape.Rectangle; if (bindingSetup != null) { bindingSetup.Apply(this); } }
// -------------------- override protected void OnCreatePressed(bool selectAfterwards) { ControlFreak2.TouchSteeringWheel newObj = (ControlFreak2.TouchSteeringWheel) this.CreateDynamicTouchControl(typeof(ControlFreak2.TouchSteeringWheel)); newObj.pressBinding.CopyFrom(this.pressBinding); newObj.analogTurnBinding.CopyFrom(this.turnBinding); newObj.turnRightBinding.CopyFrom(this.turnRightBinding); newObj.turnLeftBinding.CopyFrom(this.turnLeftBinding); TouchControlWizardUtils.CreateWheelAnimator(newObj, "-Sprite", this.defaultSprite, 1.0f); Undo.RegisterCreatedObjectUndo(newObj.gameObject, "Create CF2 Wheel"); if (selectAfterwards) { Selection.activeObject = newObj; } }
// -------------------------- protected TouchControl CreateNonDynamicTouchControl(System.Type controlType) { TouchControl c = null; if (this.positionMode == NonDynamicControlWizardBase.PositionMode.ConstantSize) { c = TouchControlWizardUtils.CreateStaticControl(controlType, this.panel, this.panel.transform, this.controlName, this.GetAnchorPos(), this.GetControlOffset(), this.GetControlSize(), this.GetControlDepth()); } else { c = TouchControlWizardUtils.CreateStretchyControl(controlType, this.panel, this.panel.transform, this.controlName, this.GetRegionRect(), this.GetRegionDepth()); //this.GetControlDepth()); } c.shape = this.controlShape; return(c); }
// ---------------------- protected TouchControl CreateDynamicTouchControl(System.Type controlType) { TouchControl c = null; if (this.dynamicMode == ControlMode.Static) { c = TouchControlWizardUtils.CreateStaticControl(controlType, this.panel, this.panel.transform, this.controlName, this.GetAnchorPos(), this.GetControlOffset(), this.GetControlSize(), this.GetControlDepth()); } else { c = TouchControlWizardUtils.CreateDynamicControlWithRegion(controlType, this.panel, this.controlName, this.GetControlSize(), this.GetRegionRect(), this.GetRegionDepth(), this.GetControlDepth()); } c.shape = this.controlShape; return(c); }
// ------------------ public void Init(TouchControlPanel panel, TouchJoystickCreationWizard.BindingSetup bindingSetup, System.Action onCreationCallback) { base.Init(panel, onCreationCallback); this.controlName = //(((bindingSetup != null) && !string.IsNullOrEmpty(bindingSetup.joyName)) ? ("Joystick-" + bindingSetup.joyName) : TouchControlWizardUtils.GetUniqueJoystickName(panel.rig); this.defaultControlName = this.controlName; this.dynamicMode = ControlMode.DynamicWithRegion; this.regionRect = RegionRectPreset.LeftHalf; this.hatScale = 0.75f; this.defaultSprite = TouchControlWizardUtils.GetDefaultDpadSprite(); this.hatSprite = TouchControlWizardUtils.GetDefaultAnalogJoyHatSprite(); this.baseSprite = TouchControlWizardUtils.GetDefaultAnalogJoyBaseSprite(); if (bindingSetup != null) { bindingSetup.Apply(this); } }