| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class PKGameSettleViewNew : MonoBehaviour
- {
- // Start is called before the first frame update
- void OnEnable()
- {
- SimulateMouseController.ins?.AddOpenLocker(this);
- int[] pkResults = { 0, 0 };
- var gc = GameController.ins;
- if (gc.scores[0] > gc.scores[1])
- {
- pkResults[0] = 1;
- pkResults[1] = -1;
- }
- else if (gc.scores[0] < gc.scores[1])
- {
- pkResults[0] = -1;
- pkResults[1] = 1;
- }
- for (int i = 1; i <= 2; i++)
- {
- int index = i - 1;
- transform.Find("Win" + i).gameObject.SetActive(pkResults[index] == 1);
- transform.Find("Fail" + i).gameObject.SetActive(pkResults[index] == -1);
- transform.Find("Draw" + i).gameObject.SetActive(pkResults[index] == 0);
- transform.Find("Score" + i + "/Text").GetComponent<Text>().text = gc.scores[index].ToString();
- }
- }
- void OnDisable()
- {
- SimulateMouseController.ins?.RemoveOpenLocker(this);
- }
- public void OnClick_Again()
- {
- gameObject.SetActive(false);
- AudioMgr.ins.PlayBtn();
- GameController.ins.InitGame();
- GameController.ins.HandleSelectDistance(GameController.ins.targetDistance);
- }
- public void OnClick_Back()
- {
- gameObject.SetActive(false);
- AudioMgr.ins.PlayBtn();
- GameController.ins.InitGame();
- GameController.ins.SetDisplayDistanceSelectView(true);
- }
- }
|