示例#1
0
 public PassGuide(GameObject imageGo, Text text, int typeIndex, int index, PassGuide next)
 {
     this.text      = text;
     this.typeIndex = typeIndex;
     this.index     = index;
     this.next      = next;
     this.imageGo   = imageGo;
 }
示例#2
0
 private void showImage(PassGuide guide)
 {
     foreach (GameObject go in gos[guide.typeIndex].gos)
     {
         go.SetActive(false);
     }
     guide.imageGo.SetActive(true);
 }
示例#3
0
    public void showHelp(int index, bool guide)
    {
        transform.gameObject.SetActive(true);         //
        transform.Find("Canvas/content").gameObject.SetActive(true);
        this.gos[index].go.SetActive(true);
        GameObject[] gos     = this.gos[index].gos;
        PassGuide    current = null;
        PassGuide    last    = null;

        for (int i = 0; i < gos.Length; i++)
        {
            GameObject go        = gos[i];
            PassGuide  passGuide = new PassGuide(go, text, index, i, null);
            if (last != null)
            {
                last.next = passGuide;
            }
            if (current == null)
            {
                current = passGuide;
            }
            last = passGuide;
        }

        showImage(current);
        current.doAction();


        Button button = transform.Find("Canvas/content/mask").GetComponent <Button> ();

        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(delegate {
            Sound.playSound(SoundType.Click);
            current = current.next;
            if (current != null)
            {
                showImage(current);
                current.doAction();
            }
            else
            {
                if (guide)
                {
                    transform.gameObject.SetActive(false);
                    transform.Find("Canvas/content").gameObject.SetActive(false);
                    this.gos[index].go.SetActive(false);
                    // 完成这个新手引导,发送后端
                    CSNewGuideFinish guideFinish = new CSNewGuideFinish();
                    guideFinish.Id   = index;
                    guideFinish.Step = 1;
                    SocketManager.SendMessageAsyc((int)MiGongOpcode.CSNewGuideFinish, CSNewGuideFinish.SerializeToBytes(guideFinish), delegate(int opcode, byte[] data) {
                        SCNewGuideFinish ret = SCNewGuideFinish.Deserialize(data);
                        GameObject mainGo    = GameObject.Find("main");
                        MainPanel mainPanel  = mainGo.GetComponent <MainPanel>();
                        mainPanel.setGuideState((GuideType)index, 1);
                    });
                }
                else
                {
                    transform.Find("Canvas/content").gameObject.SetActive(false);
                    this.gos[index].go.SetActive(false);
                }
            }
        });
    }