public static void CreateSlice(Transform target) { if (control == null) { control = Object.FindObjectOfType(typeof(IndicatorControl)) as IndicatorControl; } if (control != null) { control.NewSlice(target); } }
public static void CreateSlice(Transform target) { if (control == null) { control = (IndicatorControl)FindObjectOfType(typeof(IndicatorControl)); } if (control != null) { control.NewSlice(target); } }
private void Form1_Load(object sender, EventArgs e) { SetOthelloControl(); int width = this.Width; var cellSize = new Size(width / OthelloObj.CellNum, width / OthelloObj.CellNum); Width += 30; Height += 50; for (int rowIndex = 0; rowIndex < OthelloObj.CellNum; rowIndex++) { for (int colIndex = 0; colIndex < OthelloObj.CellNum; colIndex++) { var cell = new CellControl(rowIndex, colIndex); cell.Size = cellSize; cell.Location = new Point(cellSize.Width * rowIndex + rowIndex, cellSize.Width * colIndex + colIndex); cell.DataBindings.Add("state", OthelloObj.table[rowIndex, colIndex], "state", false, DataSourceUpdateMode.OnPropertyChanged); Controls[0].Controls.Add(cell); OthelloObj.table[rowIndex, colIndex].ChangeState(OthelloObj.GetInitialCellState(OthelloObj.CellNum / 2, rowIndex, colIndex)); cell.SizeMode = PictureBoxSizeMode.StretchImage; cell.MouseClick += (cellSender, CellE) => OthelloObj.CellSelect(cellSender, CellE); } } var lblPlayerScore = new Label(); var pctIndicator = new IndicatorControl(); var lblPlayerIdentity = new Label(); lblPlayerScore.Font = new Font(lblPlayerScore.Font.FontFamily, 18); lblPlayerScore.DataBindings.Add("Text", OthelloObj.players[0], "identityVal"); lblPlayerScore.Location = new Point(pctIndicator.Right, 0); pctIndicator.DataBindings.Add("state", OthelloObj.players[0], "myTurn"); Controls[1].Controls.Add(pctIndicator); Controls[1].Controls.Add(lblPlayerScore); var lblPlayerScore2 = new Label(); var pctIndicator2 = new IndicatorControl(); lblPlayerScore2.Font = new Font(lblPlayerScore2.Font.FontFamily, 18); lblPlayerScore2.DataBindings.Add("Text", OthelloObj.players[1], "identityVal"); lblPlayerScore2.Location = new Point(pctIndicator2.Right, 0); pctIndicator2.DataBindings.Add("state", OthelloObj.players[1], "myTurn"); Controls[2].Controls.Add(pctIndicator2); Controls[2].Controls.Add(lblPlayerScore2); //pnlScoreBoard.Controls.Add(lblPlayerIdentity); //pnlScoreBoard.Controls.Add(lblPlayerScore); //pnlScoreBoard.Controls.Add(pctIndicator); OthelloObj.MarkNextClickPlace(Othello.OthelloClass.playerColorConverter[OthelloObj.nowPlayer.myColor]); OthelloObj.gameStarted = true; OthelloObj.nowPlayer.TurnStart(); }
public void stateUpdate(int start) { for (int i = start - 1; i > 0; i--) { if (detectors_on_array[i]) { IndicatorControl.updateStudentIndicator(detectors_names[i], this); return; } } GameObject indicator = GameObject.Find(this.id); if (indicator == null) { Debug.LogError("??????? Something is wrong regarding indicators"); } indicator.GetComponent <MeshRenderer>().material = (Material)Resources.Load("UI_Resources/Materials/NormalIndicator", typeof(Material)); }
/// <summary> /// Revert back to the default GestureRecognizer. /// </summary> /*public void ResetGestureRecognizers() * { * // Default to the navigation gestures. * Transition(ManipulationRecognizer); * } * * /// <summary> * /// Transition to a new GestureRecognizer. * /// </summary> * /// <param name="newRecognizer">The GestureRecognizer to transition to.</param> * public void Transition(GestureRecognizer newRecognizer) * { * if (newRecognizer == null) * { * return; * } * * if (ActiveRecognizer != null) * { * if (ActiveRecognizer == newRecognizer) * { * return; * } * * ActiveRecognizer.CancelGestures(); * ActiveRecognizer.StopCapturingGestures(); * } * * //if (IndicatorControl.inMoveMode) * newRecognizer.StartCapturingGestures(); * //else * //newRecognizer.StopCapturingGestures(); * ActiveRecognizer = newRecognizer; * }*/ private void ManipulationRecognizer_ManipulationStartedEvent(InteractionSourceKind source, Vector3 position, Ray ray) { if (InteractibleManager.Instance.FocusedGameObject != null) { IndicatorControl.removeWorldAnchor(InteractibleManager.Instance.FocusedGameObject, InteractibleManager.Instance.FocusedGameObject.name); //for better tracking? InteractibleManager.Instance.tempFocusedGameObject = InteractibleManager.Instance.FocusedGameObject; IndicatorControl.removeWorldAnchor(InteractibleManager.Instance.tempFocusedGameObject, InteractibleManager.Instance.tempFocusedGameObject.name); //can probably mix these into same variable IndicatorControl.inMoveMode = true; IsManipulating = true; ManipulationPosition = position; InteractibleManager.Instance.FocusedGameObject.SendMessageUpwards("PerformManipulationStart", position); } }
private void Start() { // Singleton if (m_indicatorControl == null) { DontDestroyOnLoad(this.gameObject); m_indicatorControl = this; } else if (m_indicatorControl != this) { Destroy(this); } // Spawn Damage Indicators for(int i = 0; i < indicatorBuffer; i++) { Indicator tempDI = Instantiate(m_indicator) as Indicator; tempDI.transform.SetParent(this.transform); indicatorPool.Add(tempDI); } }
public void Awake() { IndicatorControl.CreateSlice(transform); }
private void ManipulationRecognizer_ManipulationCompletedEvent(InteractionSourceKind source, Vector3 position, Ray ray) { IsManipulating = false; IndicatorControl.createWorldAnchor(InteractibleManager.Instance.tempFocusedGameObject, InteractibleManager.Instance.tempFocusedGameObject.name); InteractibleManager.Instance.tempFocusedGameObject = null; }
// event handler void OnUpdate(Socket socket, Packet packet, params object[] args) { List <object> detectorResults = args[0] as List <object>; //iterate over detector results list ... // process each entry in order to update a central, global representation (per-student dictionary named studentModels) foreach (Dictionary <string, object> detectorResult in detectorResults) { Dictionary <string, object> thisUser = detectorResult["user"] as Dictionary <string, object>; string thisUserFirstName = thisUser["first_name"] as string; string thisUserLastName = thisUser["last_name"] as string; string thisUserUserName = thisUser["username"] as string; string thisDetector = detectorResult["name"] as string; string thisValue = detectorResult["value"] as string; string testOutput = string.Format("User: {0} {1} ({2}), \n Detector: {3}, \n Value: {4}", thisUserFirstName, thisUserLastName, thisUserUserName, thisDetector, thisValue); //Debug.Log(testOutput); GetComponent <TextMesh>().text = testOutput; DataPiece info; if (SavedData.data.get(thisUserUserName, out info)) { //updating existing students info Debug.Log("updating existing student info"); if (info.detectors == null) { Debug.LogError("Dictionary of detectors for this student has not been intialized"); } //update the value assocated with this detector. you rewrite the previous value. info.detectors.Remove(thisDetector); info.detectors.Add(thisDetector, thisValue); /*string debug; * info.detectors.TryGetValue(thisDetector, out debug); * Debug.Log(thisDetector + " " + debug); * * if (info.id.EndsWith("08")) * Debug.Log("BOOOOOOOOOOOO"); * if (info.id.EndsWith("08")) * Debug.Log(thisDetector + " " + debug);*/ IndicatorControl.updateStudentIndicator(thisDetector, info); } else { //adding a new student info = new DataPiece(); info.datatype = "student"; info.firstName = thisUserFirstName; info.lastName = thisUserLastName; info.id = thisUserUserName; info.detectors = new Dictionary <string, string>(); info.detectors.Add(thisDetector, thisValue); IndicatorControl.createStudentIndicator(info); SavedData.data.add(thisUserUserName, info); Debug.Log("CREATED NEW STUDENT: " + thisUserUserName); } } }