Ejemplo n.º 1
0
        public ViewResult Subtract2p(int id, string s, string anchorId)
        {
            AlwaysUpdate();
            var mute      = MutedSound;
            var changable = Changable;

            ViewData["PlaySound"] = true;
            ViewData["Sound"]     = "boo";

            TwoPlayer score = _entities.TwoPlayers.Where(p => p.ID == id).FirstOrDefault();

            if (s == "1")
            {
                score.Score1 = score.Score1 - 1;
            }
            else if (s == "2")
            {
                score.Score2 = score.Score2 - 1;
            }

            _entities.SaveChanges();

            ViewData["AnchorID"] = anchorId;
            return(View("Index", Tuple.Create(_entities.TwoPlayers.ToList(), _entities.FourPlayers.ToList(), _entities.Players.ToList())));
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            TwoPlayer game = new TwoPlayer();

            this.Hide();
            game.ShowDialog();
            this.Close();
        }
        internal void AttachTo(TwoPlayer board, GameState model)
        {
            _board = board;
            _model = model;

            board.SquareTapped  += OnBoardSquareTapped;
            board.SwitchPlayers += (sender, e) =>
            {
                StartTurn();
            };

            model.StateChanged += Model_StateChanged;
        }
Ejemplo n.º 4
0
    void Start()
    {
        Instance      = this;
        draw          = new DrawNumber();
        tmp           = 0;
        ScorePlayer_1 = 0;
        ScorePlayer_2 = 0;

        // Set margin by screen size
        if (((float)Screen.height / (float)Screen.width) < 1.7f)
        {
            marginLeft  = 25f;
            marginRight = 25f;
        }
        else
        {
            marginLeft  = 40f;
            marginRight = 40f;
        }

        // Sound
        SoundClick1 = (AudioSource)gameObject.AddComponent <AudioSource>();
        SoundClick2 = (AudioSource)gameObject.AddComponent <AudioSource>();
        SoundResult = (AudioSource)gameObject.AddComponent <AudioSource>();

        AudioClip ClickAudioClip_1;

        ClickAudioClip_1 = (AudioClip)Resources.Load("Audio/Click_Number1");
        SoundClick1.clip = ClickAudioClip_1;
        SoundClick1.loop = false;

        AudioClip ClickAudioClip_2;

        ClickAudioClip_2 = (AudioClip)Resources.Load("Audio/Click_Number2");
        SoundClick2.clip = ClickAudioClip_2;
        SoundClick2.loop = false;

        AudioClip ResultAudioClip;

        ResultAudioClip  = (AudioClip)Resources.Load("Audio/Winner");
        SoundResult.clip = ResultAudioClip;
        SoundResult.loop = false;

        isSoundON = UIManagerScript.Instance.isSoundON;
        isMusicON = UIManagerScript.Instance.isMusicON;

        ShowListNumber();
    }
Ejemplo n.º 5
0
        public ViewResult Delete2p(int id, string anchorId)
        {
            AlwaysUpdate();
            var mute      = MutedSound;
            var changable = Changable;

            TwoPlayer score = _entities.TwoPlayers.Where(p => p.ID == id).FirstOrDefault();

            try
            {
                _entities.TwoPlayers.Remove(score);
            }
            catch { }

            _entities.SaveChanges();

            ViewData["AnchorID"] = anchorId;
            return(View("Index", Tuple.Create(_entities.TwoPlayers.ToList(), _entities.FourPlayers.ToList(), _entities.Players.ToList())));
        }