Ejemplo n.º 1
0
    /**
     * Instantiates submenu items.
     */
    IEnumerator CreateSubMenu()
    {
        buttonArray = new GameObject[numbOfMenuItems];
        for (int i = 0; i < numbOfMenuItems; i++)
        {
            MenuItemVals itemVals     = CalcItemLocationOnArc(i, numbOfMenuItems);
            Vector3      itemPosition = itemVals.Position;

            itemPosition = itemPosition + menuInstance.transform.position;

            MenuBtn btn = new MenuBtn();

            btn.SetStartEndPos(menuInstance.transform.position, itemPosition);
            btn.SetAngleFromMenuStart(itemVals.Angle);

            GameObject clone = Instantiate(btnPrefab, itemPosition, Quaternion.identity, menuInstance.transform);
            clone.name = i.ToString();

            btn.SetName(clone.name);

            // GameObject clone = Instantiate(btnPrefab, menuInstance.transform.position, Quaternion.identity, menuInstance.transform);
            Vector3 endPos = itemPosition + menuInstance.transform.position;
            // LerpClones(clone, menuInstance.transform.position, endPos);
            buttonArray[i] = clone;
        }
        readyToLerp = true;
        Debug.Log(readyToLerp);
        startTime      = Time.time;
        distanceLength = Vector3.Distance(menuInstance.transform.position, buttonArray[0].transform.position);
        Debug.Log("distanceLength");
        Debug.Log(distanceLength);
        yield return(new WaitForSeconds(1f));
    }
Ejemplo n.º 2
0
 private void CreateMenu()
 {
     for (int i = 0; i < numberOfBtns; i++)
     {
         Vector3 pos = CalcBtnPosition(i, radius);
         Debug.Log(pos);
         MenuBtn mb = Instantiate(menuBtn, pos, Quaternion.identity, transform);
         menuBtns.Add(mb);
     }
 }
Ejemplo n.º 3
0
    void Start()
    {
        if (PhotonNetwork.connected || PhotonNetwork.connecting)
        {
            PhotonNetwork.Disconnect();
        }


        scene1Button = new MenuBtn()
        {
            Text = "Was bisher geschah...",
            Link = "MidgardBisher"
        };

        scene2Button = new MenuBtn()
        {
            Text = "Mord im Kloster",
            Link = "MidgardGame-Scene"
        };

        wuerfelButton = new MenuBtn()
        {
            Text = "Zum Würfeldeck",
            Link = "MidgardWuerfel"
        };

        charGenButton = new MenuBtn()
        {
            Text = "Zum Midgard Charaktergenerator",
            Link = "MidgardUICharGen"
        };

        charChoserButton = new MenuBtn()
        {
            Text = "Midgard Charakter auswählen",
            Link = "CharacterChooser"
        };

        charAvatarButton = new MenuBtn()
        {
            Text = "3D-Avatar wählen",
            Link = "AvatarChoser"
        };

        m_Headline         = new GUIStyle(this.Skin.label);
        m_Headline.padding = new RectOffset(3, 0, 0, 0);
    }
Ejemplo n.º 4
0
        protected virtual void OnClickListener(GameObject gob)
        {
            MenuBtn btnid = (MenuBtn)UIEventListener.Get(gob).parameter;

            switch (btnid)
            {
            case MenuBtn.DismissRoomBtn:
                OnClickDismissRoomBtn();
                break;

            case MenuBtn.SettingBtn:
                OnCLickSettingBtn();
                break;

            case MenuBtn.ChangeBtn:
                OnClickChangeBtn();
                break;
            }
        }
Ejemplo n.º 5
0
 public void CloseTarget(MenuBtn btn)
 {
     foreach (var w in Windows)
     {
         if (w == btn.target)
         {
             continue;
         }
         w.SetActive(false);
     }
     foreach (var b in btns)
     {
         if (b == btn)
         {
             continue;
         }
         b.status = false;
     }
 }
Ejemplo n.º 6
0
    void Update()
    {
        Victim       = GameObject.FindGameObjectWithTag("Victim");
        VictimRadius = Victim.transform.Find("Radius").gameObject;
        ShowCommunicate();
        EnteredVictimArea();
        if (VictimRadius.GetComponent <UIAppear>().GetActive() || RescueRadius.GetComponent <RescueMeny>().GetActive())
        {
            HowBtn.GetComponent <Button>().interactable  = false;
            MenuBtn.GetComponent <Button>().interactable = false;

            if (IsXClickable)
            {
                TripleBtnClose.GetComponent <Button>().interactable = true;
            }
            else
            {
                TripleBtnClose.GetComponent <Button>().interactable = false;
            }
            if (IsTripleMidClickable)
            {
                TripleMid.GetComponent <Button>().interactable   = true;
                TripleBtnBg.GetComponent <Button>().interactable = true;
                TripleBot.GetComponent <Button>().interactable   = false;
            }
            if (IsTutorialFinished)
            {
                TripleBot.GetComponent <Button>().interactable = true;
            }
        }
        else
        {
            TripleBtnClose.GetComponent <Button>().interactable = true;
            TutorialBtnReact.TripleBtnToggle(false);
            HowBtn.GetComponent <Button>().interactable  = true;
            MenuBtn.GetComponent <Button>().interactable = true;
        }
    }
Ejemplo n.º 7
0
        void Update()
        {
            if (phase == MenuPhase.MENU && Input.GetButtonDown("Vertical"))
            {
                if (Input.GetAxis("Vertical") < 0 && menuBtn == MenuBtn.PLAY)
                {
                    selector.DOAnchorPosY(creditsBtn_y, 1f);
                    menuBtn = MenuBtn.CREDITS;
                    SfxManager.I.Play("sfx_over");
                }
                else if (Input.GetAxis("Vertical") < 1 && menuBtn == MenuBtn.CREDITS)
                {
                    selector.DOAnchorPosY(playBtn_y, 1f);
                    menuBtn = MenuBtn.PLAY;
                    SfxManager.I.Play("sfx_over");
                }
            }

            if (Input.GetButtonDown("Jump"))
            {
                if (phase == MenuPhase.MENU && menuBtn == MenuBtn.PLAY)
                {
                    StartCoroutine(PlayCO());
                }
                else if (phase == MenuPhase.MENU && menuBtn == MenuBtn.CREDITS)
                {
                    Credits.SetActive(true);
                    phase = MenuPhase.CREDITS;
                }
                else if (phase == MenuPhase.CREDITS)
                {
                    Credits.SetActive(false);
                    phase = MenuPhase.MENU;
                }
            }
        }
Ejemplo n.º 8
0
        protected override void OnClickListener(GameObject gob)
        {
            MenuBtn btnid   = (MenuBtn)UIEventListener.Get(gob).parameter;
            var     gdata   = App.GetGameData <FillpitGameData>();
            var     gserver = App.GetRServer <FillpitGameServer>();

            switch (btnid)
            {
            case MenuBtn.OpenMenu:
                Vector3 v = MenuBgTween.transform.localPosition;
                MoveMenuBg(v, new Vector3(-8, v.y, v.z));
                CloseBtn.SetActive(true);
                break;

            case MenuBtn.BackBtn:
                bool isPlayed    = gdata.IsPlayed;
                bool isRoomOwner = gdata.IsRoomOwner;

                if (!gdata.IsRoomGame)
                {
                    if (CouldOut())
                    {
                        YxMessageBox.Show(new YxMessageBoxData
                        {
                            Msg      = "您确定要退出游戏吗?",
                            BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                            Listener = (box, btnName) =>
                            {
                                if (btnName == YxMessageBox.BtnLeft)
                                {
                                    if (CouldOut())
                                    {
                                        App.QuitGame();
                                    }
                                }
                            }
                        });
                    }
                    return;
                }

                if (isPlayed)
                {
                    YxMessageBox.Show(new YxMessageBoxData()
                    {
                        Msg      = "确定要发起投票,解散房间么?",
                        BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                        Listener = (box, btnName) =>
                        {
                            if (btnName == YxMessageBox.BtnLeft)
                            {
                                gserver.SendHandsUp(2);      //房间游戏已开始,发起投票
                            }
                        }
                    });
                }
                else if (isRoomOwner)
                {
                    //房卡游戏没有开始,房主解散房间
                    YxMessageBox.Show(new YxMessageBoxData()
                    {
                        Msg      = "确定要解散房间吗?",
                        Listener = (box, btnName) =>
                        {
                            if (btnName == YxMessageBox.BtnLeft)
                            {
                                if (CouldOut())
                                {
                                    IRequest req = new ExtensionRequest("dissolve", new SFSObject());
                                    App.GetRServer <FillpitGameServer>().SendRequest(req);
                                }
                            }
                        },
                        IsTopShow = true,
                        BtnStyle  = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle
                    });
                }
                else
                {
                    if (CouldOut())
                    {
                        App.QuitGame();
                    }
                }

                CloseMenu();
                break;


            case MenuBtn.ChangeBtn:

                if (CouldOut())
                {
                    foreach (var yxBaseGamePlayer in gdata.PlayerList)
                    {
                        var player = (PlayerPanel)yxBaseGamePlayer;
                        player.Reset();
                        player.gameObject.SetActive(false);
                    }

                    gserver.ChangeRoom();
                    YxWindowManager.ShowWaitFor();
                }
                else
                {
                    YxDebug.Log("正在游戏中,不能更换房间!");
                    YxMessageBox.Show(new YxMessageBoxData()
                    {
                        Msg       = "正在游戏中,不能更换房间!",
                        IsTopShow = true,
                    });
                }
                CloseMenu();
                break;

            case MenuBtn.HelpBtn:         //显示牌类按钮
                if (HelpPanel != null)
                {
                    HelpPanel.SetActive(true);
                }
                CloseMenu();
                break;

            case MenuBtn.CloseBtn:
                CloseMenu();
                break;

            case MenuBtn.SettingBtn:
                SettingPanel.SetActive(true);
                CloseMenu();
                break;

            case MenuBtn.DismissRoomBtn:

                if (gdata.IsRoomGame && (gdata.IsPlayed || gdata.IsGameing))
                {
                    YxMessageBox.Show(new YxMessageBoxData
                    {
                        Msg      = "确定要发起投票,解散房间么?",
                        BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                        Listener = (box, btnName) =>
                        {
                            if (btnName == YxMessageBox.BtnRight)
                            {
                                gserver.SendHandsUp(2);
                            }
                        },
                    });
                }
                CloseMenu();

                break;
            }
        }
Ejemplo n.º 9
0
        protected void OnClickListener(GameObject gob)
        {
            MenuBtn btnid = (MenuBtn)UIEventListener.Get(gob).parameter;
            var     gdata = App.GetGameData <DuifenGlobalData>();

            switch (btnid)
            {
            case MenuBtn.Menu_Btn:
                CloseBtn.SetActive(true);

                foreach (GameObject tween in BtnTweens)
                {
                    tween.GetComponent <TweenColor>().ResetToBeginning();
                    tween.GetComponent <TweenScale>().ResetToBeginning();
                }

                if (App.GetGameData <DuifenGlobalData>().IsRoomGame)
                {
                    if (BackBtn != null)
                    {
                        if (gdata.OwnerId == App.GetGameData <DuifenGlobalData>().GetPlayerInfo().Id || gdata.IsPlayed)
                        {
                            string   sprName = "dismiss";
                            UIButton btn     = BackBtn.GetComponent <UIButton>();
                            btn.normalSprite   = sprName + "_up";
                            btn.pressedSprite  = sprName + "_over";
                            btn.hoverSprite    = sprName + "_over";
                            btn.disabledSprite = sprName + "_up";
                        }
                    }

                    if (ChangeBtn != null)
                    {
                        ChangeBtn.SetActive(false);
                    }

                    MenuPanelGrid.cellHeight = 100;
                }

                MenuListBgTween.PlayForward();
                break;

            case MenuBtn.Back_Btn:
                //开放模式下,走解散房间,否则更换房间
                if (App.GetGameData <DuifenGlobalData>().IsRoomGame&& (gdata.OwnerId == App.GetGameData <DuifenGlobalData>().GetPlayerInfo().Id || gdata.IsPlayed))
                {
                    DismissRoom();
                }
                else
                {
                    QuitRoom();
                }
                CloseMenu();
                break;

            case MenuBtn.Change_Btn:
                ChangeRoom();
                CloseMenu();
                break;

            case MenuBtn.Help_Btn:
                OnClickHelpBtn();
                CloseMenu();
                break;

            case MenuBtn.Close_Btn:
                CloseMenu();
                break;

            case MenuBtn.Setting_Btn:
                OnClickSettingBtn();
                CloseMenu();
                break;

            case MenuBtn.History_Btn:
                App.GetGameManager <DuifenGameManager>().HistoryResultMgr.ShowHistoryView();
                CloseMenu();
                break;
            }
        }
Ejemplo n.º 10
0
        protected void OnClickListener(GameObject gob)
        {
            MenuBtn btnid = (MenuBtn)UIEventListener.Get(gob).parameter;
            var     mgr   = App.GetGameManager <GangWuGameManager>();
            var     gdata = App.GetGameData <GangwuGameData>();

            switch (btnid)
            {
            case MenuBtn.OpenMenu:
                Vector3 v = MenuBgTween.transform.localPosition;
                MoveMenuBg(v, new Vector3(-8, v.y, v.z));
                CloseBtn.SetActive(true);
                break;

            case MenuBtn.BackBtn:
                ////退出游戏按钮事件

                if (CouldOut())
                {
                    YxMessageBox.Show(new YxMessageBoxData()
                    {
                        Msg       = "确定要退出游戏么?",
                        BtnStyle  = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                        IsTopShow = true,
                        Listener  = (box, btnName) =>
                        {
                            if (btnName == YxMessageBox.BtnLeft)
                            {
                                if (CouldOut())
                                {
                                    App.QuitGame();
                                }
                                else
                                {
                                    YxMessageBox.Show(new YxMessageBoxData()
                                    {
                                        Msg          = "游戏已经开始,请在游戏结束后退出!",
                                        ShowBtnNames = new[] { YxMessageBox.BtnMiddle },
                                        IsTopShow    = true,
                                    });
                                }
                            }
                        }
                    });
                }

                CloseMenu();
                break;


            case MenuBtn.ChangeRoomBtn:

                if (CouldOut())
                {
                    foreach (var yxBaseGamePlayer in gdata.PlayerList)
                    {
                        var player = (PlayerPanel)yxBaseGamePlayer;
                        player.Reset();
                        player.RefreshPanel();
                        player.gameObject.SetActive(false);
                    }

                    App.GetRServer <GangWuGameServer>().ChangeRoom();
                    YxWindowManager.ShowWaitFor();
                }
                else
                {
                    YxDebug.Log("正在游戏中,不能更换房间!");
                    YxMessageBox.Show(new YxMessageBoxData()
                    {
                        Msg       = "正在游戏中,不能更换房间!",
                        IsTopShow = true,
                    });
                }
                CloseMenu();
                break;

            case MenuBtn.HelpBtn:         //显示牌类按钮
                HelpPanel.SetActive(true);
                CloseMenu();
                break;

            case MenuBtn.CloseBtn:
                CloseMenu();
                break;

            case MenuBtn.SettingBtn:
                SettingView.SetActive(true);
                CloseMenu();
                break;

            case MenuBtn.DismissRoomBtn:
                if (gdata.IsRoomGame && (gdata.IsPlayed || gdata.IsGameStart))
                {
                    YxMessageBox.Show(new YxMessageBoxData
                    {
                        Msg      = "确定要发起投票,解散房间么?",
                        BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                        Listener = (box, btnName) =>
                        {
                            if (btnName == YxMessageBox.BtnRight)
                            {
                                App.GetRServer <GangWuGameServer>().StartHandsUp(2);
                            }
                        },
                    });
                }
                CloseMenu();
                break;

            case MenuBtn.HistoryBtn:

                mgr.HistoryResultMgr.ShowHistoryView();
                CloseMenu();
                break;
            }
        }