public void EnableMenuInGame() { desplegarSFX.Play(); menuInGameEnabled = !menuInGameEnabled; botonMenuInvisible.gameObject.SetActive(menuInGameEnabled); MovePieces movePieces = this.gameObject.GetComponent <MovePieces> (); movePieces.isPuzzlePlaying = !menuInGameEnabled; if (menuInGameEnabled) { UpdatePauseButtons(); arrowMenuInGame.rotation = Quaternion.Euler(new Vector3(0, 0, 180)); if (tutorialAlert.gameObject.activeSelf) { CloseTutorialAlert(); } StartCoroutine(SlideMenuInGame(true)); } else { arrowMenuInGame.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); StartCoroutine(SlideMenuInGame(false)); } }
public void EndTurn(Piece movedPiece, int x1, int y1, int x2, int y2) { MovePieces?.Invoke(movedPiece, x2, y2); CheckForKing(movedPiece, x1, y2); // Our message if (Client != null && Client.isHost == IsWhiteTurn) { string msg = "CMOV|"; msg += x1 + "|"; msg += y1 + "|"; msg += x2 + "|"; msg += y2.ToString(); Client.Send(msg); } // Сканировать на возможный ход (если убили). Для продолжения хода. if (HasForcedMoves(x2, y2) && HasKilled) { HasKilled = false; return; } HasKilled = false; IsWhiteTurn = !IsWhiteTurn; OnEndTurn?.Invoke(IsWhiteTurn, Client); CheckVictory(); }
public void ActivarMenuInGame() { desplegarSFX.Play(); menuIngameActivado = !menuIngameActivado; botonMenuInvisible.gameObject.SetActive(menuIngameActivado); MovePieces moverPiezas = this.gameObject.GetComponent <MovePieces>(); moverPiezas.puzzlePlaying = !menuIngameActivado; if (menuIngameActivado) { ActualizarBotonesPause(); flechitaMenuInGame.rotation = Quaternion.Euler(new Vector3(0, 0, 180)); if (noticeTutorial.gameObject.activeSelf) { CerrarAvisoTutorial(); } StartCoroutine(DesplazarMenuInGame(true)); } else { flechitaMenuInGame.rotation = Quaternion.Euler(new Vector3(0, 0, 0)); StartCoroutine(DesplazarMenuInGame(false)); } }
// Use this for initialization void Start() { if (ActionObj.tag == "Movable") { mp = ActionObj.gameObject.GetComponent <MovePieces> (); } }
public void Initialize(int v, Point p, Sprite piece) { img = GetComponent <Image>(); rect = GetComponent <RectTransform>(); mp = MovePieces.instance; value = v; SetIndex(p); img.sprite = piece; }
void Start() { //获取主客户端游戏对象 objetoControlador = GameObject.Find("Controlador"); //获取碎片控制组件 movePieces = objetoControlador.GetComponent <MovePieces>(); //获取主客户端控制器(界面UI控制器) controlUI = objetoControlador.GetComponent <ControlUI>(); //未放置的拼图碎片 piecesUnplaced = new List <GameObject>(); //拼图碎片尺寸(NXN?) string dimensionesPuzzle = this.gameObject.name.Substring(5, this.gameObject.name.Length - 5); string[] dosDimensiones = dimensionesPuzzle.Split('x'); widthPuzzle = int.Parse(dosDimensiones[0]); heightPuzzle = int.Parse(dosDimensiones[1]); //注意矩阵数组和锯齿数组的区别 piecesPuzzle = new Transform[widthPuzzle, heightPuzzle]; posicionInicial = new Vector3[widthPuzzle, heightPuzzle]; distanceBetweenPieces = new DistanceBetweenPieces[widthPuzzle, heightPuzzle]; //间隔 margenSnap = 0.2f - (widthPuzzle * 0.01f); //它从0.16(4X4的谜题)到(10X16的谜题) //记录初始位置 for (int i = 0; i < heightPuzzle; i++) { for (int k = 0; k < widthPuzzle; k++) { piecesPuzzle[k, i] = transform.GetChild(i * widthPuzzle + k); posicionInicial[k, i] = piecesPuzzle[k, i].position; piecesUnplaced.Add(piecesPuzzle[k, i].gameObject); } } for (int i = 0; i < heightPuzzle; i++) { for (int k = 0; k < widthPuzzle; k++) { if (k > 0) { distanceBetweenPieces[k, i].left = Mathf.Abs(piecesPuzzle[k, i].position.x - piecesPuzzle[k - 1, i].position.x); } if (k < widthPuzzle - 1) { distanceBetweenPieces[k, i].right = Mathf.Abs(piecesPuzzle[k + 1, i].position.x - piecesPuzzle[k, i].position.x); } if (i > 0) { distanceBetweenPieces[k, i].up = Mathf.Abs(piecesPuzzle[k, i - 1].position.y - piecesPuzzle[k, i].position.y); } if (i < heightPuzzle - 1) { distanceBetweenPieces[k, i].down = Mathf.Abs(piecesPuzzle[k, i].position.y - piecesPuzzle[k, i + 1].position.y); } } } }
void Start() { controllerObject = GameObject.Find("Controller"); movePieces = controllerObject.GetComponent <MovePieces> (); controlUI = controllerObject.GetComponent <ControlUI> (); unplacedPieces = new List <GameObject> (); string puzzleDimensions = this.gameObject.name.Substring(5, this.gameObject.name.Length - 5); string[] twoDimensions = puzzleDimensions.Split('x'); puzzleWidth = int.Parse(twoDimensions [0]); puzzleHeight = int.Parse(twoDimensions [1]); piecesArray = new Transform[puzzleWidth, puzzleHeight]; initialPiecePosArray = new Vector3[puzzleWidth, puzzleHeight]; distanceBetweenPieces = new DistanceBetweenPieces[puzzleWidth, puzzleHeight]; snapMargin = 0.2f - (puzzleWidth * 0.01f); //Va desde 0.16 (El puzzle de 4) hasta 0.10 (El puzzle de 10) for (int i = 0; i < puzzleHeight; i++) { for (int k = 0; k < puzzleWidth; k++) { piecesArray [k, i] = transform.GetChild(i * puzzleWidth + k); initialPiecePosArray [k, i] = piecesArray [k, i].position; unplacedPieces.Add(piecesArray [k, i].gameObject); } } for (int i = 0; i < puzzleHeight; i++) { for (int k = 0; k < puzzleWidth; k++) { if (k > 0) { distanceBetweenPieces [k, i].left = Mathf.Abs(piecesArray [k, i].position.x - piecesArray [k - 1, i].position.x); } if (k < puzzleWidth - 1) { distanceBetweenPieces [k, i].right = Mathf.Abs(piecesArray [k + 1, i].position.x - piecesArray [k, i].position.x); } if (i > 0) { distanceBetweenPieces [k, i].above = Mathf.Abs(piecesArray [k, i - 1].position.y - piecesArray [k, i].position.y); } if (i < puzzleHeight - 1) { distanceBetweenPieces [k, i].below = Mathf.Abs(piecesArray [k, i].position.y - piecesArray [k, i + 1].position.y); } } } }
public void VolverDesdePuzzle(bool confirmacion) { clickSFX.Play(); if (confirmacion) { MovePieces moverPiezas = this.gameObject.GetComponent <MovePieces>(); moverPiezas.puzzlePlaying = false; if (newPuzzle != null) { Destroy(newPuzzle); } SeleccionarImagen(puzzlePreseleccionado); } seguroMenu.SetActive(false); }
public void VolverAMenuTrasCompletar() { clickSFX.Play(); MovePieces moverPiezas = this.gameObject.GetComponent <MovePieces>(); moverPiezas.puzzlePlaying = false; if (newPuzzle != null) { Destroy(newPuzzle); } SeleccionarImagen(puzzlePreseleccionado); //颜色,如果你刚刚完成困难 if (this.diyMode) { //nothing to do } else { contornoBoton[puzzlePreseleccionado].color = colorDificultad[PlayerPrefs.GetInt("puzzleCompleto" + puzzlePreseleccionado, 0)]; if (PlayerPrefs.GetInt("puzzleCompleto" + puzzlePreseleccionado, 0) == 5) { TexturaABoton(puzzlePreseleccionado, loadImagenes.puzzleImageList[puzzlePreseleccionado]); } } #if PLATFORM_ANDROID //if (puedeMostrarAnuncioExtra && Advertisement.IsReady("rewardedVideo")) { // contadorTiempoAnuncio = 0; // puedeMostrarAnuncioExtra = false; // puedeMostrarAnuncio = false; // ShowRewardedAdExtra(); //} //else if (puedeMostrarAnuncio && Advertisement.IsReady()) { // contadorTiempoAnuncio = 0; // puedeMostrarAnuncioExtra = false; // puedeMostrarAnuncio = false; // ShowAd(); //} #endif //panelInit.SetActive(true); //panelSelection.SetActive(false); //panelPreGame.SetActive(false); //panelInGame.SetActive(false); //panelComplete.SetActive(false); this.ActiveUI("panelInit"); }
public void StartPuzzle() { //newPuzzle.SetActive(true); MovePieces movePieces = this.gameObject.GetComponent <MovePieces> (); movePieces.attachPieces = GameObject.FindGameObjectWithTag("MatrizPuzzle").GetComponent <AttachPieces> (); DisableBGHelp(); ShufflePieces(newPuzzle.transform); //Barajar Piezas startingTime = Time.time; panelMain.SetActive(false); panelSelection.SetActive(false); panelPreGame.SetActive(false); panelInGame.SetActive(true); panelComplete.SetActive(false); Invoke("EnableControls", 0.5f); if (PlayerPrefs.GetInt("yaUsoBotonSort", 0) == 0) { Invoke("EnableTutorialPopUp", 30); } }
public void VolverAMenuTrasCompletar() { clickSFX.Play(); MovePieces movePieces = this.gameObject.GetComponent <MovePieces> (); movePieces.isPuzzlePlaying = false; if (newPuzzle != null) { Destroy(newPuzzle); } SelectImage(preselectedPuzzle); //COLOREAR SI SE ACABA DE COMPLETAR EN DIFICIL buttonBorders [preselectedPuzzle].color = difficultyColors[PlayerPrefs.GetInt("puzzleCompleto" + preselectedPuzzle, 0)]; if (PlayerPrefs.GetInt("puzzleCompleto" + preselectedPuzzle, 0) == 5) { TexturaABoton(preselectedPuzzle, imageDownloadScript.puzzleImageList [preselectedPuzzle]); } #if PLATFORM_ANDROID if (puedeMostrarAnuncioExtra && Advertisement.IsReady("rewardedVideo")) { contadorTiempoAnuncio = 0; puedeMostrarAnuncioExtra = false; puedeMostrarAnuncio = false; ShowRewardedAdExtra(); } else if (puedeMostrarAnuncio && Advertisement.IsReady()) { contadorTiempoAnuncio = 0; puedeMostrarAnuncioExtra = false; puedeMostrarAnuncio = false; ShowAd(); } #endif panelMain.SetActive(true); panelSelection.SetActive(false); panelPreGame.SetActive(false); panelInGame.SetActive(false); panelComplete.SetActive(false); }
public void StartPuzzle() { //获取碎片控制组件 MovePieces moverPiezas = this.gameObject.GetComponent <MovePieces>(); moverPiezas.assemblePieces = GameObject.FindGameObjectWithTag("MatrizPuzzle").GetComponent <AssemblePieces>(); DesactivarAyudaBG(); DesordenarPiezas(newPuzzle.transform); //随机碎片 horaInicio = Time.time; //panelInit.SetActive(false); //panelSelection.SetActive(false); //panelPreGame.SetActive(false); //panelInGame.SetActive(true); //panelComplete.SetActive(false); this.ActiveUI("panelInGame"); Invoke("ActiveController", 0.5f); if (PlayerPrefs.GetInt("isFirstTime", 0) == 0) { Invoke("ActivarAvisoTutorial", 10); } analiticas.DificultadSeleccionada(theLastDifficultySelection + 1); analiticas.PuzzleSeleccionado(puzzlePreseleccionado); }
void ActiveController() { MovePieces moverPiezas = this.gameObject.GetComponent <MovePieces>(); moverPiezas.puzzlePlaying = true; }
private void Awake() { instance = this; }
public void Awake() { instance = this; }
void EnableControls() { MovePieces movePieces = this.gameObject.GetComponent <MovePieces> (); movePieces.isPuzzlePlaying = true; }
public void Awake() { mp = GameObject.Find("Match3").GetComponent <MovePieces>(); }