public void startSearchDebate(Task w) { this.taskRunning = true; targetScale = scale = 1.0f; w.isWaitingForTaskToComplete = true; waiter = w; descriptionBG.Start(); descriptionBG.setFadeValue(0.0f); counterBG.Start(); counter.gameObject.GetComponent <UITextFader> ().Start(); int deb = 0; for (int i = 0; i < controlHub.gameController.chosenDebates.Count; ++i) { if (controlHub.gameController.chosenDebates [i] != -1) { ++deb; } //if(debateChosen[i]) { // controlHub.gameController.chosenDebates [deb++] = debateIndices[i]; //} } //if (firstTime) numPages = 7; //else // numPages = (controlHub.gameController.chosenDebates.Count - deb) * 3; showingDetail = false; page = 0; state = 0; stateWaitScroll = 0; chosen = deb; xScroll = 0.0f; targetScale = 1.0f; counter.text = chosen + "/3"; counter.gameObject.GetComponent <UITextFader> ().fadeIn(); counterBG.fadeOut(); theDebates = new GameObject[numPages]; debateIndices = new int[numPages]; debateChosen = new bool[numPages]; for (int i = 0; i < numPages; ++i) { debateChosen [i] = false; } tick.unpress(); //controlHub.touchableThingsController.cantTouchThis = true; // disable interface touch controlHub.touchableThingsController.CanTouch(true); left1.Start(); left2.Start(); right1.Start(); right2.Start(); down1.Start(); down2.Start(); left1.setFadeValue(0.0f); left2.setFadeValue(0.0f); right1.setFadeValue(0.0f); right2.setFadeValue(0.0f); down1.setFadeValue(0.0f); down2.setFadeValue(0.0f); //eligeText.SetActive (false); debatesScroll.transform.localScale = new Vector3(1, 1, 1); int r; for (int i = 0; i < numPages; ++i) { GameObject newGO = (GameObject)Instantiate(debateFramePrefab, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)); //choose a debate at random r = Random.Range(0, controlHub.masterController.dbinfo.items.Length); Debug.Log("r: " + r); int loopScape = 100; // just in case // controlHub.gameController.chosenDebates.Contains (r) || // impedir repeticion string cat = controlHub.masterController.dbinfo.items [r].category; bool allowed = controlHub.menuController.isCategoryAllowed [cat]; while ((filterON) && (loopScape > 0) && ((!allowed) || (controlHub.masterController.dbinfo.items [r].difficulty > controlHub.menuController.maxDifficulty) || (controlHub.masterController.dbinfo.items [r].difficulty < controlHub.menuController.minDifficulty))) { r = Random.Range(0, controlHub.masterController.dbinfo.items.Length); Debug.Log("r: " + r); cat = controlHub.masterController.dbinfo.items [r].category; if (controlHub.menuController.isCategoryAllowed.ContainsKey(cat)) { allowed = controlHub.menuController.isCategoryAllowed [cat]; } else { Debug.Log("OffendingCat: " + cat); } --loopScape; if (loopScape == 0) { filterON = false; } } newGO.GetComponentInChildren <Text> ().text = controlHub.masterController.dbinfo.items [r].title; newGO.transform.SetParent(debatesScroll.transform); newGO.transform.localScale = new Vector3(globalScale * debateFrameScale, globalScale * debateFrameScale, globalScale * debateFrameScale); newGO.GetComponent <DebateItem> ().setAbsent(false); newGO.GetComponent <DebateItem> ().setDifficulty(controlHub.masterController.dbinfo.items [r].difficulty); newGO.transform.localPosition = new Vector3(pageWidth * i, 0, 0); RawImage[] facesImages = newGO.GetComponentsInChildren <RawImage> (); controlHub.faceBank.chooseFaces(r); facesImages [2].texture = controlHub.faceBank.leftFace; facesImages [3].texture = controlHub.faceBank.rightFace; theDebates [i] = newGO; debateIndices [i] = r; } //debatesScroll.transform.localScale = new Vector3 (debateFrameScale, debateFrameScale, debateFrameScale); debatesScroll.transform.localPosition = new Vector3(1920, 0, 0); debatesScroll.transform.localScale = new Vector3(debateFrameScale, debateFrameScale, debateFrameScale); if (numPages > 0) { right1.fadeIn(); right2.fadeIn(); } state = 1; firstTime = false; }
public void debateDetails() { if (state != 0) { return; } if (touchIsMovement) { touchIsMovement = false; return; } if (stateWaitScroll != -1) // show details { stateWaitScroll = -1; // disabled if (page < numPages) { if (!debateChosen [page]) { tick.unpress(); } else { tick.press(); } } tick.gameObject.GetComponent <UIFaderScript> ().fadeOut(); left1.fadeOut(); left2.fadeOut(); right1.fadeOut(); right2.fadeOut(); //eligeText.SetActive (false); down1.fadeIn(); down2.fadeIn(); if (page < numPages) { debateDescription.GetComponent <Text> ().text = controlHub.masterController.dbinfo.items [debateIndices [page]].description; } debateDescription.fadeIn(); descriptionBG.fadeOut(); targetScale = 0.45f; state = 3; showingDetail = true; } else // hide details { stateWaitScroll = 0; if (page != 0) { left1.fadeIn(); left2.fadeIn(); } if (page != (numPages - 1)) { right1.fadeIn(); right2.fadeIn(); } //eligeText.SetActive (true); down1.fadeOut(); down2.fadeOut(); tick.gameObject.GetComponent <UIFaderScript> ().fadeIn(); targetScale = 1.0f; state = 3; debateDescription.fadeOut(); descriptionBG.fadeIn(); } }