public Knot( List <Vector3> points, OculusTouch oculusTouch, int meridian = 20, float radius = 0.1f, float distanceThreshold = -1, List <Curve> collisionCurves = null, LogicalButton buttonA = null, LogicalButton buttonB = null, LogicalButton buttonC = null, LogicalButton buttonD = null, Material curveMaterial = null, Material pullableCurveMaterial = null, Material pointMaterial = null ) { buttonA = buttonA ?? LogicalOVRInput.RawButton.A; buttonB = buttonB ?? LogicalOVRInput.RawButton.B; buttonC = buttonC ?? LogicalOVRInput.RawButton.RIndexTrigger; buttonD = buttonD ?? LogicalOVRInput.RawButton.RHandTrigger; int count = points.Count; (int first, int second)chosenPoints = (count / 3, 2 * count / 3); KnotData data = new KnotData(points, chosenPoints, oculusTouch, radius, meridian, distanceThreshold, collisionCurves, buttonA, buttonB, buttonC, buttonD, curveMaterial, pullableCurveMaterial, pointMaterial); this.state = new KnotStateBase(data); Curve.SetUp(oculusTouch, drawButton: buttonC, moveButton: buttonD); }
public bool GetUp(LogicalButton logicalButton) { if (!this.mappedButtons.ContainsKey(logicalButton)) { return(false); } return(this.mappedButtons[logicalButton].Any(physicalButton => physicalButton.GetUp())); }
private void CheckSolution(LogicalButton button) { this.pressCount++; if (button.IsPressed || (button.Index + 1 != this.solution[this.pressCount - 1])) { Debug.LogFormat("[Logical Buttons #{2}] Pressed incorrect button {0}, expected button {1}. Strike!", button.Index + 1, this.solution[this.pressCount - 1], this._moduleId); this.InitLogic(); Module.HandleStrike(); for (int i = 0; i < Borders.Length; i++) { Borders[i].material = BorderOffMat; } return; } button.IsPressed = true; Borders[button.Index].material = BorderOnMat; Debug.LogFormat("[Logical Buttons #{0}] Pressed correct button {1}.", this._moduleId, button.Index + 1); if (this.pressCount == this.solution.Count) { StageLights[this.stage - 1].sharedMaterial = LightOnMat; Lights[this.stage - 1].enabled = true; if (this.stage == 3) { stage++; Debug.LogFormat("[Logical Buttons #{0}] All 3 stages passed. Module solved.", this._moduleId); this.isSolved = true; Module.HandlePass(); Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, Module.transform); Btn1Text.text = ""; Btn2Text.text = ""; Btn3Text.text = ""; ColorBlindIndicatorTop.text = "Green"; ColorBlindIndicatorLeft.text = "Green"; ColorBlindIndicatorRight.text = "Green"; Btn1Renderer.sharedMaterial = materials[2]; Btn2Renderer.sharedMaterial = materials[2]; Btn3Renderer.sharedMaterial = materials[2]; for (int i = 0; i < Borders.Length; i++) { Borders[i].material = BorderOffMat; } OperatorTxt.text = correct[rnd.Range(0, correct.Count)]; } else { Debug.LogFormat("[Logical Buttons #{0}] Completed stage {1}.", this._moduleId, this.stage); for (int i = 0; i < Borders.Length; i++) { Borders[i].material = BorderOffMat; } this.stage++; Audio.PlayGameSoundAtTransform(KMSoundOverride.SoundEffect.CorrectChime, Module.transform); this.InitLogic(); } } }
public void Merge(ButtonMap other) { foreach (var mappedButton in other.mappedButtons) { LogicalButton logicalButton = mappedButton.Key; List <IPhysicalButton> physicalButtons = mappedButton.Value; if (this.mappedButtons.ContainsKey(logicalButton)) { this.mappedButtons[logicalButton].AddRange(physicalButtons); } else { this.mappedButtons[logicalButton] = physicalButtons; } } }
public Optimize(OculusTouch oculusTouch, List <HandCurve> deformableCurves, List <HandCurve> collisionCurves, float segment, float epsilon, string flowClass, LogicalButton button1, LogicalButton button2) { this.deformableCurves = deformableCurves; List <Vector3[]> pointsList = new List <Vector3[]>(); this.collisionCurves = collisionCurves; if (segment <= 0) { throw new System.Exception("segment must be positive"); } this.segment = segment; this.oculusTouch = oculusTouch; for (int i = 0; i < this.deformableCurves.Count; i++) { if (!(this.deformableCurves[i].curve is ClosedCurve)) { throw new System.Exception("curves must be closed"); } this.deformableCurves[i].curve = this.deformableCurves[i].curve.Equalize(this.deformableCurves[i].segment); this.deformableCurves[i].MeshUpdate(); pointsList.Add(this.deformableCurves[i].curve.GetPoints().ToArray()); this.minSeg = Mathf.Min(this.minSeg, this.deformableCurves[i].segment); } if (flowClass == "Moebius") { curveFlow = new Moebius(pointsList, this.segment, 1e-04f); } else if (flowClass == "MeanCurvature") { curveFlow = new MeanCurvature(pointsList, this.segment, 0.05f); } elasticity = new Elasticity(pointsList, this.segment, 1e-01f); this.button1 = button1; this.button2 = button2; this.epsilon = epsilon; }
public ContextMenu( OculusTouch controller, LogicalButton upButton, LogicalButton downButton, LogicalButton confirmButton, LogicalButton toggleMenuButton, uint?lockLevel = 10 ) { this.controller = controller; this.upButton = upButton; this.downButton = downButton; this.confirmButton = confirmButton; this.toggleMenuButton = toggleMenuButton; this.lockLevel = lockLevel; FindCanvasObject(); LoadPrefabs(); CreatePanel(); }
public Controller() { this.oculusTouch = new OculusTouch ( buttonMap: LiteralKeysPlus, rightStickKey: PredefinedMaps.WASD, rightHandKey: PredefinedMaps.OKLSemiIComma, handScale: 0.03f, handSpeed: 0.01f ); this.changeState = LogicalOVRInput.RawButton.LIndexTrigger; this.draw = LogicalOVRInput.RawButton.RIndexTrigger; this.move = LogicalOVRInput.RawButton.RHandTrigger; this.select = LogicalOVRInput.RawButton.A; this.cut = LogicalOVRInput.RawButton.B; this.combine = LogicalOVRInput.RawButton.X; this.remove = LogicalOVRInput.RawButton.Y; this.undo = LogicalOVRInput.RawButton.LHandTrigger; this.pull = LogicalOVRInput.RawButton.X; this.energy = LogicalOVRInput.RawButton.Y; }
public Optimize(OculusTouch oculusTouch, List <Curve> newCurves, List <Curve> collisionCurves, float epsilon, LogicalButton button1, LogicalButton button2) { this.newCurves = newCurves; this.collisionCurves = collisionCurves; this.oculusTouch = oculusTouch; for (int i = 0; i < this.newCurves.Count; i++) { this.newCurves[i].points = AdjustParameter.Equalize(this.newCurves[i].points, this.newCurves[i].segment, true); this.newCurves[i].MomentumInitialize(); } // this.intersectionManager = new IntersectionManager(this.newCurves, this.collisionCurves, epsilon); this.button1 = button1; this.button2 = button2; this.epsilon = epsilon; }
void Start() { this.oculusTouch = new OculusTouch ( buttonMap: LiteralKeysPlus, leftStickKey: PredefinedMaps.Arrows, rightHandKey: PredefinedMaps.OKLSemiIComma, handScale: 0.03f, handSpeed: 0.01f ); this.comfirmBotton = LogicalOVRInput.RawButton.X; this.contextMenu = new ContextMenu.ContextMenu( this.oculusTouch, upButton: LogicalOVRInput.RawButton.LStickUp, downButton: LogicalOVRInput.RawButton.LStickDown, confirmButton: comfirmBotton, toggleMenuButton: LogicalOVRInput.RawButton.LIndexTrigger, lockLevel: null ); this.contextMenu.AddItem(new MenuItem("左人差し指 : メニューウィンドウの開閉", () => {})); this.contextMenu.AddItem(new MenuItem("左スティック : カーソルの移動", () => {})); this.contextMenu.AddItem(new MenuItem("Xボタン : メニューでの決定ボタン", () => {})); this.contextMenu.AddItem(new MenuItem("", () => {})); this.contextMenu.Open(); this.dataHandler = new DataHandler( inputDirOnPC: "CurveData", outputDirOnPC: "CurveData", cacheDirOnPC: "CurveData", inputDirOnHMD: "/mnt/sdcard/CurveData", outputDirOnHMD: "/mnt/sdcard/CurveData", cacheDirOnHMD: "/mnt/sdcard/CurveData" ); this.state = new BasicDeformation(this.oculusTouch, this.contextMenu, this.dataHandler, new List <Curve>(), comfirm: comfirmBotton); }
public static bool IsYellowConditionMet(LogicalButton button) { return(!button.Label.Equals(Constants.WrongString) && !button.Label.Equals(Constants.LogicString)); }
public static bool IsPurpleConditionMet(LogicalButton button1, LogicalButton button2) { return(!IsPrimaryColor(button1.Color) && !IsPrimaryColor(button2.Color)); }
public static void SetUp(OculusTouch oculusTouch, LogicalButton drawButton, LogicalButton moveButton) { HandCurve.oculusTouch = oculusTouch; HandCurve.drawButton = drawButton; HandCurve.moveButton = moveButton; }
public static bool IsGreenConditionMet(LogicalButton button) { return(button.Color == ButtonColor.Purple || button.Color == ButtonColor.White); }
public static bool IsGreyConditionMet(LogicalButton button, IList <LogicalButton> otherButtons) { return(otherButtons.Any(x => x.Label.Equals(button.Label))); }
public static bool IsWhiteConditionMet(LogicalButton button1, LogicalButton button2) { return(IsPrimaryColor(button1.Color) || IsPrimaryColor(button2.Color)); }
public BasicDeformation(OculusTouch oculusTouch, ContextMenu.ContextMenu contextMenu, DataHandler dataHandler, List <Curve> curves, LogicalButton changeState = null, LogicalButton draw = null, LogicalButton move = null, LogicalButton select = null, LogicalButton cut = null, LogicalButton comfirm = null) : base(oculusTouch, contextMenu, dataHandler, curves) { base.NumberOfUnselectableItems = 9; this.preCurves = base.curves; this.drawingCurve = new Curve(new List <Vector3>(), false); this.movingCurves = new List <int>(); if (draw != null) { this.draw = draw; } else { this.draw = LogicalOVRInput.RawButton.RIndexTrigger; } if (move != null) { this.move = move; } else { this.move = LogicalOVRInput.RawButton.RHandTrigger; } if (select != null) { this.select = select; } else { this.select = LogicalOVRInput.RawButton.A; } if (cut != null) { this.cut = cut; } else { this.cut = LogicalOVRInput.RawButton.B; } if (comfirm != null) { this.comfirm = comfirm; } else { this.comfirm = LogicalOVRInput.RawButton.X; } Curve.SetUp(base.oculusTouch, this.draw, this.move); }
public static bool IsLabelColorMet(LogicalButton button) { return(new[] { ButtonColor.Green, ButtonColor.Yellow, ButtonColor.Orange }.All(x => x != button.Color)); }
public static bool IsOrangeConditionMet(LogicalButton button) { return(button.Color != ButtonColor.Orange); }
public static bool IsRedConditionMet(LogicalButton button1, LogicalButton button2) { return(button1.Color != ButtonColor.Blue && button2.Color != ButtonColor.Blue); }
private void HandleButtonPressWithNoSolution(LogicalButton button) { Debug.LogFormat("[Logical Buttons #{1}] Pressed incorrect button {0}, expected screen button. Strike!", button.Index + 1, this._moduleId); Module.HandleStrike(); this.InitLogic(); }
public static bool IsLabelBoomMet(LogicalButton button1, LogicalButton button2) { return(button1.Color == button2.Color); }
public static bool IsLabelLabelMet(LogicalButton button) { return(button.Label.Length != 5); }
public static bool IsCyanConditionMet(LogicalButton button) { return(button.Label.Length == 5); }
public static bool IsLabelButtonMet(LogicalButton button) { return(!button.Label.Equals(Constants.HmmmString) && !button.Label.Equals(Constants.NoString)); }
public static bool IsLabelWrongMet(LogicalButton currentButton, LogicalButton previousButton) { return(currentButton.Color == previousButton.Color); }
void HandleButton(string button, bool newState) { bool isModifier = IgnoreKeys.Contains(button); if (EnableIgnoreModifiers && isModifier) { return; } if (LastState[button] && newState) { return; } if (!LastState[button] && !newState) { return; } //apply //NOTE: this is not quite right. if someone held leftshift+rightshift it would be broken. seems unlikely, though. if (button == "LeftShift") { _Modifiers &= ~ModifierKey.Shift; if (newState) { _Modifiers |= ModifierKey.Shift; } } if (button == "RightShift") { _Modifiers &= ~ModifierKey.Shift; if (newState) { _Modifiers |= ModifierKey.Shift; } } if (button == "LeftControl") { _Modifiers &= ~ModifierKey.Control; if (newState) { _Modifiers |= ModifierKey.Control; } } if (button == "RightControl") { _Modifiers &= ~ModifierKey.Control; if (newState) { _Modifiers |= ModifierKey.Control; } } if (button == "LeftAlt") { _Modifiers &= ~ModifierKey.Alt; if (newState) { _Modifiers |= ModifierKey.Alt; } } if (button == "RightAlt") { _Modifiers &= ~ModifierKey.Alt; if (newState) { _Modifiers |= ModifierKey.Alt; } } if (UnpressState.ContainsKey(button)) { if (newState) { return; } Console.WriteLine("Removing Unpress {0} with newState {1}", button, newState); UnpressState.Remove(button); LastState[button] = false; return; } //dont generate events for things like Ctrl+LeftControl ModifierKey mods = _Modifiers; if (button == "LeftShift") { mods &= ~ModifierKey.Shift; } if (button == "RightShift") { mods &= ~ModifierKey.Shift; } if (button == "LeftControl") { mods &= ~ModifierKey.Control; } if (button == "RightControl") { mods &= ~ModifierKey.Control; } if (button == "LeftAlt") { mods &= ~ModifierKey.Alt; } if (button == "RightAlt") { mods &= ~ModifierKey.Alt; } var ie = new InputEvent { EventType = newState ? InputEventType.Press : InputEventType.Release, LogicalButton = new LogicalButton(button, mods) }; LastState[button] = newState; //track the pressed events with modifiers that we send so that we can send corresponding unpresses with modifiers //this is an interesting idea, which we may need later, but not yet. //for example, you may see this series of events: press:ctrl+c, release:ctrl, release:c //but you might would rather have press:ctr+c, release:ctrl+c //this code relates the releases to the original presses. //UPDATE - this is necessary for the frame advance key, which has a special meaning when it gets stuck down //so, i am adding it as of 11-sep-2011 if (newState) { ModifierState[button] = ie.LogicalButton; } else { if (ModifierState[button] != null) { LogicalButton alreadyReleased = ie.LogicalButton; var ieModified = new InputEvent { LogicalButton = (LogicalButton)ModifierState[button], EventType = InputEventType.Release }; if (ieModified.LogicalButton != alreadyReleased) { _NewEvents.Add(ieModified); } } ModifierState[button] = null; } _NewEvents.Add(ie); }
public static bool IsBlueConditionMet(LogicalButton button1, LogicalButton button2) { return(button1.Color == ButtonColor.Blue || button2.Color == ButtonColor.Blue); }