private void LoadMarkerObjects() { for (int t = 0; t < objectPoolSize; t++) { GameObject _sfObj = Instantiate(Resources.Load("Prefabs/MarkerObj", typeof(GameObject))) as GameObject; if (_sfObj != null) { if (MarkerObjectContainer != null) { _sfObj.transform.parent = MarkerObjectContainer.transform; } _sfObj.name = "squareObj" + t.ToString(); //default storage location _sfObj.transform.position = new Vector2(StoragePosition.transform.position.x, StoragePosition.transform.position.y); _sfObj.transform.localScale = new Vector2(targetScale * MarkerScale, targetScale * MarkerScale); MarkerObj objectScript = _sfObj.GetComponent <MarkerObj> (); objectScript.ID = t; MarkerObjectList.Add(_sfObj); } else { Debug.Log("Couldn't load marker object prefab"); } } }
void QuerySetObjectsResetPosition() { foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); objectScript.SetGridPosition(new Vector3(StoragePosition.transform.position.x, StoragePosition.transform.position.y, -0.5f)); } }
private void QuerySetMarkerObjectsRotation() { foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); objectScript.SetMarkerLabelRotation(MarkerLabelRotation); } }
void QuerySetMarkerObjectsScale() { foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); objectScript.SetMarkerScale(targetScale * MarkerScale); } }
void QuerySetMarkerObjectsLoaded() { foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); objectScript._State = MarkerObj.eState.Loaded; } }
void QueryApplyNoteToOn(int note, int interval) { //Debug.LogError ("QueryApplyNoteToOn note = " + note); foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); int noteIndex = objectScript.NoteName; if (noteIndex == note) { objectScript.SetVisibleStatus(true); //select color styles ColorSet cs = NeckNoteColors[CurrentStyle]; Color c = GetColorFromSet(cs, interval); objectScript.SetObjectColor(c.r * 255f, c.g * 255f, c.b * 255f, c.a * 255f); objectScript.SetSpriteToUse(0); int colorCode = cs.GetColorCode(0); if (colorCode == 1) { if (interval == 0) { objectScript.SetSpriteToUse(1); } else if (interval == 7) { objectScript.SetSpriteToUse(2); } else { objectScript.SetSpriteToUse(0); } } //select note display style string noteText = FormData.Instance.gKeyNamesSharp[noteIndex]; if (NoteDisplayStyle == 1) { noteText = FormData.Instance.gKeyNamesFlat[noteIndex]; } else if (NoteDisplayStyle == 2) { noteText = FormData.Instance.gIntervalText[interval]; } else if (NoteDisplayStyle == 3) { noteText = FormData.Instance.gIntervalExtendedText[interval]; } c = GetColorFromSet(cs, 12); objectScript.SetMarkerLabel(noteText, c); } } }
void QuerySetObjectsResetColor() { QuerySetFretPanelObjectsStringColor(); foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); objectScript.SetVisibleStatus(false); objectScript.SetObjectColor(255, 255, 255, 0); } }
void QueryApplyNoteAnimation(int note) { //Debug.LogError ("QueryApplyNoteToOn note = " + note); foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); int noteIndex = objectScript.NoteName; if (noteIndex == note) { objectScript.StartColorAnim(Color.white, 0.25f); } } }
public MarkerObj[][] m_arrMarkers; //List of all arrow markers public void Initialize() { m_arrMarkers = new MarkerObj[MAX_MARKERS][]; for (int nInd1 = 0; nInd1 < MAX_MARKERS; nInd1++) { m_arrMarkers[nInd1] = new MarkerObj[(int)RFExplorerSignalType.TOTAL_ITEMS]; for (int nInd2 = 0; nInd2 < (int)RFExplorerSignalType.TOTAL_ITEMS; nInd2++) { m_arrMarkers[nInd1][nInd2] = new MarkerObj(m_arrCurveColors[nInd2], 17, 0, 0); m_arrMarkers[nInd1][nInd2].ZOrder = ZOrder.A_InFront; m_arrMarkers[nInd1][nInd2].IsClippedToChartRect = true; m_arrMarkers[nInd1][nInd2].Line.Style = DashStyle.Solid; m_arrMarkers[nInd1][nInd2].IsVisible = false; m_arrMarkers[nInd1][nInd2].InsideText = (nInd1 + 1).ToString("0"); m_arrMarkers[nInd1][nInd2].Location.X = 1000.0; //initialize to 1000MHz, a rather random value } } }
void QuerySetMarkerObjectsPosition() { float xOffset = 0.42f * targetScale; float yOffset = 0f; int colCount = 0; int rowCount = 0; int noteIndex = 0; int[] notes = new int[Globals.MaxStrings + 1] { (int)Globals._notes.NOTE_E, (int)Globals._notes.NOTE_A, (int)Globals._notes.NOTE_D, (int)Globals._notes.NOTE_G, (int)Globals._notes.NOTE_B, (int)Globals._notes.NOTE_E, 0 }; int[] keySeqArray = new int[41] { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 }; if (_drawMode == DrawMode.Guitar) { noteIndex = notes[colCount]; foreach (GameObject tObj in MarkerObjectList) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); float x = gridStartX + xOffset; float y = gridStartY + yOffset; objectScript.SetGridPosition(new Vector3(x, y, -0.5f)); objectScript.NoteName = noteIndex; yOffset += FretGridDY * targetScale; rowCount++; if (rowCount >= FretGridHeight) { rowCount = 0; yOffset = 0f; xOffset += FretGridDX * targetScale; colCount++; noteIndex = notes [colCount]; } else { noteIndex++; if (noteIndex >= 12) { noteIndex = 0; } } if (colCount >= FretGridWidth) { break; } } } else if (_drawMode == DrawMode.Piano) { int lastKey = 1; int keyIndex = 0; int count = KeyboardObjectList.Count; count--; noteIndex = (int)Globals._notes.NOTE_C; foreach (GameObject tObj in MarkerObjectList) { if (keyIndex < 41) { MarkerObj objectScript = tObj.GetComponent <MarkerObj> (); float x = gridStartX + xOffset + 4f; float y = gridStartY + yOffset; GameObject key = KeyboardObjectList[count]; KeyBoardObj keyObjectScript = key.GetComponent <KeyBoardObj> (); Vector3 vpos = keyObjectScript.GetGridPosition(); if (keyObjectScript.isBlack == true) { vpos.x = vpos.x - 1f; } else { vpos.x = vpos.x + 1f; } objectScript.SetGridPosition(new Vector3(vpos.x, vpos.y, -0.5f)); objectScript.NoteName = noteIndex; int k = keySeqArray [keyIndex]; if (k == 0) { if (lastKey == 0) { yOffset += FretGridDY * targetScale; } else { yOffset += (FretGridDY / 2) * targetScale; } } else if (k == 1) { yOffset += (FretGridDY / 2) * targetScale; } noteIndex++; if (noteIndex >= 12) { noteIndex = 0; } count--; if (count < 0) { count = 0; } lastKey = k; keyIndex++; } else { break; } } } }