示例#1
0
        protected Rectangle _getSmallButtonOver(SmallButton whichOne)
        {
            int widthDelta  = smallButtonSheet.Width / 2;
            int heightDelta = smallButtonSheet.Height / (int)SmallButton.NUM_BUTTONS;

            return(new Rectangle(widthDelta, heightDelta * (int)whichOne, widthDelta, heightDelta));
        }
示例#2
0
        public Rectangle GetSmallDialogButtonOverSource(SmallButton whichButton)
        {
            var widthDelta  = SmallButtonSheet.Width / 2;
            var heightDelta = SmallButtonSheet.Height / (int)SmallButton.NUM_BUTTONS;

            return(new Rectangle(widthDelta, heightDelta * (int)whichButton, widthDelta, heightDelta));
        }
示例#3
0
        public MultiPage()
        {
            buttonsClass = new List <Button>();

            buttons.Add(new Button("Create Game"));
            buttons.Add(new Button("Join Game"));
            buttons.Add(new Button("Back"));

            #region classes
            Button c1 = new SmallButton("sprinter");
            c1.Position = new Vector2(Game1.WindowWidth / 2 - c1.Width - 135, 200);
            c1.value    = new Sprinter();
            buttonsClass.Add(c1);

            Button c2 = new SmallButton("Tank");
            c2.Position = new Vector2(c1.Position.X + 100, c1.Position.Y);
            c2.value    = new Tank();
            buttonsClass.Add(c2);
            #endregion

            PseudoInput          = new TextInput("Ton pseudo :", 16);
            PseudoInput.Position = new Vector2(80, Game1.WindowHeight / 2 - 50);
            wpPickerPosition     = new Vector2(800, Game1.WindowHeight / 2 - 50);
            wpPicker             = new WeaponPicker(wpPickerPosition);
            IpInput          = new TextInput("Server IP (join)", 16);
            IpInput.Position = new Vector2(1000, Game1.WindowHeight / 2 - 50);

            /*tPicker = new TeamPicker(new Vector2(775, Game1.WindowHeight / 2 - 90));
             * tPicker.Position = new Vector2(Game1.WindowWidth/2+150, Game1.WindowHeight/2 -50);*/
        }
示例#4
0
        public static string Generate()
        {
            var button1 = new XSmallButton("x-Small");
            var button2 = new SmallButton("Small");
            var button3 = new PrimaryButton("Regular");
            var button4 = new LargeButton("Large");

            return(button1.ToHtml() + "  " + button2.ToHtml() + button3.ToHtml() + button4.ToHtml());
        }
        /// <summary>
        /// sets the selected side
        /// </summary>
        /// <param name="side"></param>
        void SetSelectedSide(Side side)
        {
            if (side is Fryceritops fry)
            {
                Fryceritops.Background = new SolidColorBrush(Colors.LightBlue);
                Triceritots.ClearValue(Button.BackgroundProperty);
                MeteorMacAndCheese.ClearValue(Button.BackgroundProperty);
                MezzorellaSticks.ClearValue(Button.BackgroundProperty);
            }
            else if (side is Triceritots tots)
            {
                Fryceritops.ClearValue(Button.BackgroundProperty);
                Triceritots.Background = new SolidColorBrush(Colors.LightBlue);
                MeteorMacAndCheese.ClearValue(Button.BackgroundProperty);
                MezzorellaSticks.ClearValue(Button.BackgroundProperty);
            }
            else if (side is MeteorMacAndCheese mac)
            {
                Fryceritops.ClearValue(Button.BackgroundProperty);
                Triceritots.ClearValue(Button.BackgroundProperty);
                MeteorMacAndCheese.Background = new SolidColorBrush(Colors.LightBlue);
                MezzorellaSticks.ClearValue(Button.BackgroundProperty);
            }
            else if (side is MezzorellaSticks sticks)
            {
                Fryceritops.ClearValue(Button.BackgroundProperty);
                Triceritots.ClearValue(Button.BackgroundProperty);
                MeteorMacAndCheese.ClearValue(Button.BackgroundProperty);
                MezzorellaSticks.Background = new SolidColorBrush(Colors.LightBlue);
            }

            switch (side.Size)
            {
            case DinoDiner.Menu.Size.Small:
                SmallButton.Background = new SolidColorBrush(Colors.LightBlue);
                MediumButton.ClearValue(Button.BackgroundProperty);
                LargeButton.ClearValue(Button.BackgroundProperty);
                break;

            case DinoDiner.Menu.Size.Medium:
                MediumButton.Background = new SolidColorBrush(Colors.LightBlue);
                SmallButton.ClearValue(Button.BackgroundProperty);
                LargeButton.ClearValue(Button.BackgroundProperty);
                break;

            case DinoDiner.Menu.Size.Large:
                LargeButton.Background = new SolidColorBrush(Colors.LightBlue);
                SmallButton.ClearValue(Button.BackgroundProperty);
                MediumButton.ClearValue(Button.BackgroundProperty);
                break;
            }
        }
示例#6
0
 void OnWin()
 {
     if (IsWin)
     {
         if (DGameData.Instance.WinMoney > 0)
         {
             //1分1分的从赢的分数加到用户分数
             DGameData.Instance.WinMoney -= 10;
             DGameData.Instance.Fraction += 10;
             wining.SetActive(true);
         }
         else
         {
             wining.SetActive(false);
             DGameData.Instance.IsBiBei     = false;
             DGameData.Instance.str_result  = new string[6];
             DGameData.Instance.IsWinEffect = false;
             if (DGameData.Instance.BiType == 2)
             {
                 DGameData.Instance.BiType = 0;
             }
             else
             {
                 Invoke("OnCardStart", 0.5f);
             }
             for (int i = 0; i < 10; i++)
             {
                 OddListObj[i].SetActive(true);
             }
             winEffectIng.SetActive(false);
             IsWin   = false;
             IsBiBei = false;
             DGameData.Instance.IsWin = false;
             WinButton.SetActive(false);
             StartButton.SetActive(true);
             FillButton.SetActive(true);
             BanBiButton.SetActive(false);
             BiButton.SetActive(false);
             ShuangBiButton.SetActive(false);
             SmallButton.SetActive(true);
             BigButton.SetActive(true);
             DGameData.Instance.HoldData = new string[5];
         }
     }
 }
示例#7
0
        protected void _setButtons(ScrollingListDialogButtons setButtons)
        {
            if (dlgButtons.Count > 0)
            {
                dlgButtons.ForEach(_btn =>
                {
                    _btn.SetParent(null);
                    _btn.Close();
                });

                dlgButtons.Clear();
            }

            _buttons = setButtons;
            switch (setButtons)
            {
            case ScrollingListDialogButtons.BackCancel:
            case ScrollingListDialogButtons.AddCancel:
            {
                SmallButton which = setButtons == ScrollingListDialogButtons.BackCancel ? SmallButton.Back : SmallButton.Add;
                XNAButton   add   = new XNAButton(smallButtonSheet, new Vector2(48, 252), _getSmallButtonOut(which), _getSmallButtonOver(which));
                add.SetParent(this);
                add.OnClick += (o, e) => Close(add, setButtons == ScrollingListDialogButtons.BackCancel ? XNADialogResult.Back : XNADialogResult.Add);
                XNAButton cancel = new XNAButton(smallButtonSheet, new Vector2(144, 252), _getSmallButtonOut(SmallButton.Cancel), _getSmallButtonOver(SmallButton.Cancel));
                cancel.SetParent(this);
                cancel.OnClick += (o, e) => Close(cancel, XNADialogResult.Cancel);

                dlgButtons.Add(add);
                dlgButtons.Add(cancel);
            }
            break;

            case ScrollingListDialogButtons.Cancel:
            {
                XNAButton cancel = new XNAButton(smallButtonSheet, new Vector2(96, 252), _getSmallButtonOut(SmallButton.Cancel), _getSmallButtonOver(SmallButton.Cancel));
                cancel.SetParent(this);
                cancel.OnClick += (o, e) => Close(cancel, XNADialogResult.Cancel);

                dlgButtons.Add(cancel);
            }
            break;
            }
        }
示例#8
0
    IEnumerator SendBiBei(string url)
    {
        UnityWebRequest www = UnityWebRequest.Get(url);

        Debug.Log(url);
        yield return(www.Send());

        try
        {
            if (www.error == null && www.isDone)
            {
                if (www.responseCode == 200)
                {
                    JsonData jd = JsonMapper.ToObject(www.downloadHandler.text);

                    IsBiBei = true;
                    DGameData.Instance.BiType = 2;
                    Debug.Log("执行3");
                    FillButton.SetActive(false);
                    BiButton.SetActive(false);
                    BanBiButton.SetActive(false);
                    ShuangBiButton.SetActive(false);
                    SmallButton.SetActive(true);
                    BigButton.SetActive(true);
                    StartButton.SetActive(false);
                    WinButton.SetActive(true);
                    DGameData.Instance.IsColumnBoard = true;

                    for (int i = 0; i < 6; i++)
                    {
                        DGameData.Instance.str_result[i] = jd["result"][i].ToString();
                        Debug.Log("右边的牌为第" + (i + 1) + "张:" + DGameData.Instance.str_result[i]);
                    }
                }
            }
        }
        catch
        {
            Debug.Log("Json解析错误");
            DGameData.Instance.IsNetworkError = true;
        }
    }
示例#9
0
        /// <summary>
        /// sets combo size
        /// </summary>
        void SetSelectedSize()
        {
            switch (_combo.Size)
            {
            case DinoDiner.Menu.Size.Small:
                SmallButton.Background = new SolidColorBrush(Colors.LightBlue);
                MediumButton.ClearValue(Button.BackgroundProperty);
                LargeButton.ClearValue(Button.BackgroundProperty);
                break;

            case DinoDiner.Menu.Size.Medium:
                MediumButton.Background = new SolidColorBrush(Colors.LightBlue);
                SmallButton.ClearValue(Button.BackgroundProperty);
                LargeButton.ClearValue(Button.BackgroundProperty);
                break;

            case DinoDiner.Menu.Size.Large:
                LargeButton.Background = new SolidColorBrush(Colors.LightBlue);
                SmallButton.ClearValue(Button.BackgroundProperty);
                MediumButton.ClearValue(Button.BackgroundProperty);
                break;
            }
        }
        /// <summary>
        /// Creates a MenuPage with the given name, equipped with a back button that returns to the given page.
        /// </summary>
        public MenuPage(string name, MenuPage backTo)
        {
            self = new GameObject(name);
            self.transform.position = UIManager.instance.UICanvas.transform.position;
            self.transform.SetParent(UIManager.instance.UICanvas.transform);

            rt            = self.AddComponent <RectTransform>();
            rt.anchorMin  = new Vector2(0f, 0f);
            rt.anchorMax  = new Vector2(1f, 1f);
            rt.sizeDelta  = new Vector2(0f, 0f);
            rt.localScale = new Vector3(1f, 1f, 1f);
            cg            = self.AddComponent <CanvasGroup>();

            this.backTo         = backTo;
            backButton          = new SmallButton(this, "Back");
            backButton.OnClick += GoBack;

            Add(backButton.GameObject);
            backButton.MoveTo(new Vector2(0, -450));

            nav = new SimpleHorizontalNavigation(this);

            Hide();
        }
示例#11
0
        public void RenderButton(HtmlTextWriter output, ID buttonTemplateId, Ribbon ribbon, string id, string header, string icon,
                                 string tooltip, string command, bool enabled, CommandContext context, string menuPath)
        {
            var buttonId = Control.GetUniqueID("script");

            if (buttonTemplateId == Ribbon.LargeButton)
            {
                var button = new LargeButton
                {
                    ID      = buttonId,
                    Header  = header,
                    Icon    = icon,
                    Enabled = enabled,
                    ToolTip = tooltip,
                    Command = GetClick(command, context, buttonId),
                };
                button.RenderControl(output);
            }
            else if (buttonTemplateId == Ribbon.LargeMenuComboButton)
            {
                var button = new LargeMenuComboButton
                {
                    ID             = buttonId,
                    Header         = header,
                    Icon           = icon,
                    Enabled        = enabled,
                    ToolTip        = tooltip,
                    Command        = GetClick(command, context, buttonId),
                    CommandContext = context,
                    Menu           = menuPath
                };
                button.RenderControl(output);
            }
            else if (buttonTemplateId == Ribbon.SmallButton)
            {
                var button = new SmallButton
                {
                    ID      = buttonId,
                    Header  = header,
                    Icon    = icon,
                    Enabled = enabled,
                    ToolTip = tooltip,
                    Command = GetClick(command, context, buttonId),
                };
                ribbon.RenderSmallButton(output, button);
            }
            else if (buttonTemplateId == Ribbon.SmallMenuComboButton)
            {
                var button = new SmallMenuComboButton
                {
                    ID             = buttonId,
                    Header         = header,
                    Icon           = icon,
                    Enabled        = enabled,
                    ToolTip        = tooltip,
                    Command        = GetClick(command, context, buttonId),
                    CommandContext = context,
                    Menu           = menuPath
                };
                ribbon.RenderSmallButton(output, button);
            }
        }
示例#12
0
    void OnUI()
    {
        switch (DGameData.Instance.FlopNum)
        {
        case 1:
            PromptText.GetComponent <Text>().text = "<color=#FFFF00>押 注 </color>或 <color=#458b00>开 始</color>";
            break;

        case 2:
            PromptText.GetComponent <Text>().text = "<color=#458b00>保 留 </color>或 <color=#458b00>开 牌</color>";
            break;

        case 3:
            if (DGameData.Instance.WinMoney != 0)
            {
                PromptText.GetComponent <Text>().text = "<color=#458b00>得 分 </color>或 <color=#458b00>比 倍</color>";
            }
            else
            {
                PromptText.GetComponent <Text>().text = "<color=#458b00>保 留 </color>或 <color=#458b00>开 牌</color>";
            }
            break;
        }

        if (isQuitPanel)
        {
            QuitPanel.SetActive(true);
        }
        else
        {
            QuitPanel.SetActive(false);
        }
        if (isStopPanel)
        {
            StopPanel.SetActive(true);
        }
        else
        {
            StopPanel.SetActive(false);
        }
        if (isUpDownPanel)
        {
            UpDownPanel.SetActive(true);
        }
        else
        {
            UpDownPanel.SetActive(false);
        }
        if (isRecordPanel)
        {
            RecordPanel.SetActive(true);
        }
        else
        {
            RecordPanel.SetActive(false);
        }
        if (isRankingPanel)
        {
            RankingPanel.SetActive(true);
        }
        else
        {
            RankingPanel.SetActive(false);
        }

        for (int i = 0; i < 10; i++)
        {
            if (DGameData.Instance.ChargeNum != 0)
            {
                OddList[i].text = (DGameData.Instance.OddList[i] * DGameData.Instance.ChargeNum).ToString();
            }
            else
            {
                OddList[i].text = DGameData.Instance.OddList[i].ToString();
            }
        }

        AllScore.text = LoginInfo.Instance().mylogindata.ALLScroce;
        Fraction.text = DGameData.Instance.Fraction.ToString(); Fraction2.text = DGameData.Instance.Fraction.ToString();
        WinMoney.text = DGameData.Instance.WinMoney.ToString();
        BET.text      = DGameData.Instance.ChargeNum.ToString();

        if (DGameData.Instance.IsWin)
        {
            if (DGameData.Instance.BiType == 2)
            {
                FillButton.SetActive(true);
            }
            else
            {
                SmallButton.SetActive(false);
                BigButton.SetActive(false);
                FillButton.SetActive(false);
                BiButton.SetActive(true);
                BanBiButton.SetActive(true);
                ShuangBiButton.SetActive(true);
            }
            StartButton.SetActive(false);
            WinButton.SetActive(true);
        }
        else
        {
            WinButton.SetActive(false);
            StartButton.SetActive(true);
            FillButton.SetActive(true);
            SmallButton.SetActive(true);
            BigButton.SetActive(true);
            BiButton.SetActive(false);
            BanBiButton.SetActive(false);
            ShuangBiButton.SetActive(false);
        }
    }
示例#13
0
    private void Update()
    {
        OnUI();
        WinEffect();
        OnWin();

        if (DGameData.Instance.IsNetworkError)
        {
            DGameData.Instance.IsAutomatic = false;
            NetworkPrompt.SetActive(true);
        }

        if (DGameData.Instance.IsFlopCard)
        {
            OnFlop(ref CardNum);
        }
        if (isCardStart)
        {
            isCardStart = false;
            for (int i = 0; i < 5; i++)
            {
                boards[i].sprite = reverseBoard[0];
                HOLD[i].SetActive(false);
            }
            DGameData.Instance.FlopNum = 1;
            if (DGameData.Instance.IsAutomatic == false)
            {
                DGameData.Instance.BiType = 0;
            }
            DGameData.Instance.IsStart = false;
        }

        if (DGameData.Instance.IsFlopCard == false)
        {
            for (int i = 0; i < 5; i++)
            {
                if (DGameData.Instance.HoldData[i] == (i + 1).ToString())
                {
                    HOLD[i].SetActive(true);
                }
                else
                {
                    HOLD[i].SetActive(false);
                }
            }
        }

        switch (DGameData.Instance.BiType)
        {
        case 0:
            for (int i = 0; i < 10; i++)
            {
                OddListObj[i].SetActive(true);
            }
            DGameData.Instance.HoldData    = new string[5];
            DGameData.Instance.IsWinEffect = false;
            for (int i = 0; i < 5; i++)
            {
                boards[i].GetComponent <Image>().sprite = reverseBoard[0];
            }
            DGameData.Instance.ChargeNum = 0;
            DGameData.Instance.FlopNum   = 1;
            Board_Game.SetActive(true);
            Board_Contrast.SetActive(false);
            SmallButton.GetComponent <Image>().sprite = SmallButtonSprite[2];
            BigButton.GetComponent <Image>().sprite   = BigButtonSprite[2];
            FillButton.GetComponent <Image>().sprite  = FillButtonSprite[0];

            break;

        case 1:      //正常模式
            Board_Game.SetActive(true);
            Board_Contrast.SetActive(false);
            SmallButton.GetComponent <Image>().sprite = SmallButtonSprite[2];
            BigButton.GetComponent <Image>().sprite   = BigButtonSprite[2];
            FillButton.GetComponent <Image>().sprite  = FillButtonSprite[0];
            break;

        case 2:    //比倍模式
            if (DGameData.Instance.IsBiBei)
            {
                SmallButton.SetActive(false);
                BigButton.SetActive(false);
                FillButton.SetActive(false);
                BiButton.SetActive(true);
                BanBiButton.SetActive(true);
                ShuangBiButton.SetActive(true);
            }
            else
            {
                Board_Contrast.SetActive(true);
                Board_Game.SetActive(false);
                SmallButton.GetComponent <Image>().sprite = SmallButtonSprite[0];
                BigButton.GetComponent <Image>().sprite   = BigButtonSprite[0];
                FillButton.GetComponent <Image>().sprite  = FillButtonSprite[2];
            }
            break;
        }

        if (DGameData.Instance.IsAutomatic)
        {
            AutomaticButton.GetComponent <Image>().sprite = AutomaticSprite[1];
            if (StartButton.activeSelf)
            {
                if (DGameData.Instance.IsFlopCard == false && IsWin == false && DGameData.Instance.IsStart == false)
                {
                    Button_Start();
                }
            }
            if (WinButton.activeSelf)
            {
                if (DGameData.Instance.IsFlopCard == false && IsWin == false)
                {
                    OnWinButton();
                }
            }
        }
        else
        {
            AutomaticButton.GetComponent <Image>().sprite = AutomaticSprite[0];
        }



        if (DGameData.Instance.IsColumnBoard)
        {
            BiBeiPrompt.SetActive(false);
            DGameData.Instance.IsColumnBoard = false;
            int a = 0;
            for (int i = 0; i < columnBoard.Length; i++)
            {
                a = ColumnBoard_Num(i);
                columnBoard[i].sprite = boardGroup[a];
            }
        }

        if (DGameData.Instance.IsFlopColumnBoard)
        {
            BiFlopTime += Time.deltaTime;
            if (BiFlopTime > 0.06)
            {
                BiFlopTime           = 0;
                guessingBoard.sprite = reverseBoard[BiFlopNum];
                BiFlopNum++;
            }
            if (BiFlopNum >= reverseBoard.Length)
            {
                Audio.clip = Clip[1];
                Audio.Play();
                Debug.Log("得出比倍结果");
                BiFlopNum = 0;
                DGameData.Instance.IsFlopColumnBoard = false;

                guessingBoard.sprite = boardGroup[GuessingBoard_Num()];
                BiBeiPrompt.SetActive(true);
                if (DGameData.Instance.WinMoney == 0)
                {
                    Audio.clip = Clip[3];
                    Audio.Play();
                    BiBeiPrompt.GetComponent <Image>().sprite = BiBeiSprite[1];
                    Invoke("OnStart", 1.5f);
                }
                else
                {
                    Audio.clip = Clip[2];
                    Audio.Play();
                    BiBeiPrompt.GetComponent <Image>().sprite = BiBeiSprite[0];
                }
            }
        }
    }
示例#14
0
		protected Rectangle _getSmallButtonOver(SmallButton whichOne)
		{
			int widthDelta = smallButtonSheet.Width / 2;
			int heightDelta = smallButtonSheet.Height / (int)SmallButton.NUM_BUTTONS;
			return new Rectangle(widthDelta, heightDelta * (int)whichOne, widthDelta, heightDelta);
		}