Beispiel #1
0
    void Initialise()
    {
        Button BtnBack = canvas.Find("Game/BtnBack").gameObject.GetComponent <Button>();

        BtnBack.onClick.AddListener(() =>
        {
            SceneManager.LoadScene("init");
        });

        fellow = new FellowData();
        fellow.saveFellowInfo();
        lightFellowList  = fellow.getLightFellowList();
        shadowFellowList = fellow.getShadowFellowList();
        lightTurn        = true;
        //int[] demoSpot1 = { 2, 3 };
        //int[] demoSpot2 = { 3, 4 };
        //int[] demoSpot3 = { 8, 9 };
        //int[] demoSpot4 = { 7, 8 };
        //lightSpot.Add(demoSpot1);
        //lightSpot.Add(demoSpot2);
        //shadowSpot.Add(demoSpot3);
        //shadowSpot.Add(demoSpot4);
        for (int i = 0; i < LightSpot.Count; i++)
        {
            int[] demoSpot = LightSpot[i].bb;
            lightFellowSpot.Add(demoSpot);
        }
        for (int i = 0; i < ShadowSpot.Count; i++)
        {
            int[] demoSpot = ShadowSpot[i].bb;
            shadowFellowSpot.Add(demoSpot);
        }

        for (int i = 0; i < LightCampSpot.Count; i++)
        {
            int[] demoSpot = LightCampSpot[i].bb;
            lightCampSpot.Add(demoSpot);
        }
        for (int i = 0; i < ShadowCampSpot.Count; i++)
        {
            int[] demoSpot = ShadowCampSpot[i].bb;
            shadowCampSpot.Add(demoSpot);
        }
        lightFellowNum  = lightFellowSpot.Count;
        shadowFellowNum = shadowFellowSpot.Count;
        DrawChessBoard();
        DrawPlayer();
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     StartGame.onClick.AddListener(() => {
         Debug.Log("点击开始游戏");
         SceneManager.LoadScene("game");
     });
     fellow = new FellowData();
     fellow.saveFellowInfo();
     GameIntro.onClick.AddListener(() => {
         Debug.Log("点击游戏介绍");
         GameMenu.gameObject.SetActive(false);
         Introduction.gameObject.SetActive(true);
         Button btnQuit = Introduction.Find("BtnBack").GetComponent <Button>();
         btnQuit.onClick.RemoveAllListeners();
         btnQuit.onClick.AddListener(() => {
             GameMenu.gameObject.SetActive(true);
             Introduction.gameObject.SetActive(false);
             Debug.Log("点击返回至菜单");
         });
     });
     FellowHistory.onClick.AddListener(() => {
         Debug.Log("点击人物背景");
         GameMenu.gameObject.SetActive(false);
         History.gameObject.SetActive(true);
         Button btnQuit = History.Find("BtnBack").GetComponent <Button>();
         btnQuit.onClick.RemoveAllListeners();
         btnQuit.onClick.AddListener(() => {
             GameMenu.gameObject.SetActive(true);
             History.gameObject.SetActive(false);
             Debug.Log("点击返回至菜单");
         });
         for (int i = 0; i < 15; i++)
         {
             int index   = i + 1;
             string name = "Fellow" + index;
             GameObject btnLightFellow = History.Find("LightFellowList/List/" + name).gameObject;
             if (btnLightFellow != null)
             {
                 Debug.Log(string.Format("name为{0}的btnFellow不为空", name));
                 Text fellowName = btnLightFellow.transform.Find("Text").gameObject.GetComponent <Text>();
                 fellowName.text = fellow.getLightFellowByID(index - 1).fellowName;
                 Button btn      = btnLightFellow.GetComponent <Button>();
                 btn.onClick.RemoveAllListeners();
                 btn.onClick.AddListener(() =>
                 {
                     ShowFellowInfo(i, fellow.getLightFellowByID(index - 1));
                 });
             }
         }
         for (int i = 0; i < 16; i++)
         {
             int index   = i + 1;
             string name = "Fellow" + index;
             GameObject btnDarkFellow = History.Find("ShadowFellowList/List/" + name).gameObject;
             if (btnDarkFellow != null)
             {
                 Debug.Log(string.Format("name为{0}的btnFellow不为空", name));
                 Text fellowName = btnDarkFellow.transform.Find("Text").gameObject.GetComponent <Text>();
                 fellowName.text = fellow.getShadowFellowByID(index - 1).fellowName;
                 Button btn      = btnDarkFellow.GetComponent <Button>();
                 btn.onClick.RemoveAllListeners();
                 btn.onClick.AddListener(() => {
                     ShowFellowInfo(i, fellow.getShadowFellowByID(index - 1));
                 });
             }
         }
     });
 }