Beispiel #1
0
 public DrinkAnimation(TwoClient twoClient, int x, int y, float duration)
 {
     _x = x;
     _y = y;
     _duration = (long)(duration * 10000000);
     _twoClient = twoClient;
 }
Beispiel #2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (TwoClient game = new TwoClient())
     {
         game.Run();
     }
 }
Beispiel #3
0
 public Player(int n, string name, TwoClient twoClient)
 {
     Number = n;
     Name = name;
     _twoClient = twoClient;
     PlayerSelect = new PlayerSelectButton(Number);
     CurrentPlateTexture = _twoClient.PlayerTexture;
 }
Beispiel #4
0
 public TimedForm(TwoClient twoClient, string label, int timeInSeconds)
 {
     _timeLeft = timeInSeconds;
     InitializeComponent();
     _twoClient = twoClient;
     inLabel.Text = label;
     TimeLabel.Text = _timeLeft.ToString() + " seconds.";
 }
Beispiel #5
0
 public PlayerTarget(TwoClient twoClient, List<Player> playerList)
 {
     _twoClient = twoClient;
     InitializeComponent();
     foreach (Player p in playerList)
     {
         PlayerBox.Items.Add(p.Name);
     }
 }
Beispiel #6
0
 public CardMove( TwoClient twoClient, Card card, int startX, int startY, int endX, int endY, int duration )
 {
     _twoClient = twoClient;
     _startX = startX;
     _startY = startY;
     _card = card;
     _xDist = startX - endX;
     _yDist = startY - endY;
     _duration = duration*10000000;
     _startTime = System.DateTime.Now.Ticks;
 }
Beispiel #7
0
 public Button(int x, int y, int width, int height, float scale, string text, TwoClient twoClient, SpriteFont font, Texture2D butTexture)
 {
     _x = x;
     _y = y;
     _width = width;
     _scale = scale;
     MouseOver = false;
     IsActive = false;
     _twoClient = twoClient;
     _buttonText = text;
     _font = font;
     _height = height;
     _butTexture = butTexture;
     _buttonTextures = new List<Rectangle>();
     for (int i = 0; i < 3; i++)
     {
         _buttonTextures.Add(new Rectangle(0, i * 128, 256, 128));
     }
     _boxPos = new Rectangle(x, y, _width, height);
     _textPos = new Vector2(_x + _width / 2 - _font.MeasureString(_buttonText).X / 3, y + height/2 - _font.MeasureString(_buttonText).Y * .5f);
 }
Beispiel #8
0
        public ChooseList(TwoClient twoClient, int size, int width, int x, int y)
        {
            _twoClient = twoClient;
            _size = size;
            _backRec = new SmallBorderRect(_twoClient,x,width,y,size*20,0);
            ItemList = new List<string>();
            _x = x;
            _y = y;
            _width = width;

            CurSelect = -1;
            _selectRect = new Rect(_twoClient,x+2,width-4,0,20,1);
            _stringPos = new List<Vector2>();
            _clickRect = new List<Rectangle>();
            _clickList = new List<IClickable>();
            for( int i = 0; i < size; i ++)
            {
                _stringPos.Add(new Vector2(x + 3,y + 2 + 20 * i));
                _clickRect.Add(new Rectangle(x,y + 20 * i,width,20));
                _clickList.Add(new SelectItem(i));
            }
        }
Beispiel #9
0
 public StartDrinkButton(TwoClient twoClient, TimedDrinkDialog dialog, int xOffSet, int yOffSet, SpriteFont sf,Texture2D butTexture)
     : base(twoClient.WindowWidth/2 - xOffSet,twoClient.WindowHeight/2 + yOffSet,100,1f,"Start Drinking!",twoClient,sf,butTexture)
 {
     IsActive = true;
     _dialog = dialog;
     _twoClient = twoClient;
 }
Beispiel #10
0
 public override void Click(TwoClient twoClient)
 {
     _dialog.Close();
     base.Click(twoClient);
 }
Beispiel #11
0
 public CloseDrinkButton(TwoClient twoClient, TimedDrinkDialog dialog, int xOffSet, int yOffSet, SpriteFont sf,Texture2D butTexture)
     : base(twoClient.WindowWidth/2 - xOffSet,twoClient.WindowHeight/2 + yOffSet,100,1f,"Close Window",twoClient,sf,butTexture)
 {
     _dialog = dialog;
     _twoClient = twoClient;
 }
Beispiel #12
0
 public MooseForm(TwoClient twoClient, int x, int y, int width, int height )
 {
     _twoClient = twoClient;
     _timeCreated = System.DateTime.Now.Ticks;
     _oldGameState = twoClient.GameState;
     _mBut = new MooseButton(x,y, width, height,
                             twoClient,_twoClient.MOOSETexture, _oldGameState);
     _oldGameState = twoClient.GameState;
     _twoClient.SoundDict["MOOSE"].Play();
     twoClient.GameState = 4;
 }
Beispiel #13
0
 public void Click(TwoClient twoClient)
 {
     twoClient.SendMessage("MOOSE");
     twoClient.TimedDialog.IsActive = false;
     _twoClient.GameState = _oldState;
 }
Beispiel #14
0
 public void Click(TwoClient twoClient)
 {
     twoClient.SendMessage(string.Format("CARDARGS {0}", PlayerNumber.ToString()));
     twoClient.GameState = 1;
     twoClient.SoundDict["CLICK"].Play(.9f,0f,0f);
 }
Beispiel #15
0
            public override void Click(TwoClient twoClient)
            {
                base.Click(twoClient);
                if(_serverDialog.Cl.CurSelect == -1 )
                    return;
                try
                {
                    StreamWriter sw = new StreamWriter("two.cfg");
                    sw.Write(_serverDialog._tf.Current);
                    sw.Close();

                }catch( Exception e)
                {
                    twoClient.SetAnnouncement(e.ToString());
                }
                twoClient.SendJoin(_serverDialog._serverDictionary[_serverDialog.Cl.CurSelect],_serverDialog._tf.Current);
            }
Beispiel #16
0
 public StartButton(int x, int y, int width, int height, float scale, string text, TwoClient twoClient, SpriteFont font, Texture2D butTexture, ServerDialog serverDialog)
     : base(x, y, width, height, scale, text, twoClient, font, butTexture)
 {
     _serverDialog = serverDialog;
 }
Beispiel #17
0
        public ServerDialog( TwoClient twoClient)
        {
            _twoClient = twoClient;
            _findServer = "Choose a server";
            _x = _twoClient.WindowWidth/2 - 150;
            _y = _twoClient.WindowHeight/2 - 170;
            _bgRect = new Rectangle(_x,_y,300,340);
            Cl = new ChooseList(_twoClient,11,180,_x+25,_y+85);
            try
            {
                StreamReader sr = new StreamReader("two.cfg");
                _tf = new TextField(_twoClient, sr.ReadLine(), _x + 65, _y + 45, 12);
                sr.Close();
            }catch( Exception e)
            {
                _tf = new TextField(_twoClient, "def", _x + 65, _y + 45, 12);
            }

            _twoClient.keyboardObject = _tf;
            _startButton = new StartButton(_x + 217,_y + 100,75,40,1f,"Join Game", _twoClient, _twoClient.Sf,_twoClient.ButtonTexture,this);
            _startButton.IsActive = true;
        }
Beispiel #18
0
 public Rect(TwoClient twoClient, int x, int width, int y, int height, int colour)
 {
     X = x;
     Y = y;
     Width = width;
     Height = height;
     Colour = colour;
     _twoClient = twoClient;
     R = new Rectangle(x, y, width, height);
 }
Beispiel #19
0
 public ProgressBar(TwoClient twoClient, int x, int width, int y, int height, int colour)
 {
     X = x;
     Y = y;
     Width = width;
     Height = height;
     Colour = colour;
     _twoClient = twoClient;
     R = new Rectangle(x, y, 1, height);
     B = new Rectangle(x - 2, y - 2, width + 4, height + 4);
 }
Beispiel #20
0
 public override void Click(TwoClient twoClient)
 {
     IsActive = false;
     _dialog.Start();
 }
Beispiel #21
0
 public DrinkGraphic(TwoClient twoClient, int x, int y, float duration )
 {
     _drinkAnimation = new DrinkAnimation(twoClient,x,y,duration);
     _twoClient = twoClient;
     _duration = (long)(duration*10000000);
     _x = x;
     _y = y;
     IsActive = true;
 }
Beispiel #22
0
 public LightButton(int x, int y, int width, float scale, string text, TwoClient twoClient, SpriteFont font, Texture2D butTexture)
     : base(x, y, width, scale, text, twoClient, font, butTexture)
 {
 }
Beispiel #23
0
 public SmallBorderRect(TwoClient twoClient, int x, int width, int y, int height, int colour)
 {
     X = x;
     Y = y;
     Width = width;
     Height = height;
     Colour = colour;
     _twoClient = twoClient;
     R = new Rectangle(x, y, width, height);
     B = new Rectangle(x - 2, y - 2, width + 4, height + 4);
 }
Beispiel #24
0
 public MooseButton(int x, int y, int width, int height, TwoClient twoClient, Texture2D butTexture, int oldState)
 {
     _twoClient = twoClient;
     _butTexture = butTexture;
     _boxPos = new Rectangle(x, y, width, height);
     MouseOver = false;
     BeenClicked = false;
     _oldState = oldState;
 }
Beispiel #25
0
 public override void Click(TwoClient twoClient)
 {
     twoClient.DrawCard();
     base.Click(twoClient);
 }
Beispiel #26
0
 public TextField(TwoClient twoClient, string def, int x, int y, int length)
 {
     _twoClient = twoClient;
     _bgRect = new Rect(_twoClient, x, length * 15, y, 20, 0);
     Current = def;
     _stringPos = new Vector2(x + 2, y);
 }
Beispiel #27
0
 public override void Click(TwoClient twoClient)
 {
     twoClient.SendMessage("LIGHTON");
     base.Click(twoClient);
 }
Beispiel #28
0
 public void Click(TwoClient twoClient)
 {
 }
Beispiel #29
0
 public virtual void Click(TwoClient twoClient)
 {
     _twoClient.SoundDict["CLICK"].Play(.5f,0f,0f);
 }
Beispiel #30
0
        public TimedDrinkDialog( TwoClient twoClient, float delay, string toSay )
        {
            _twoClient = twoClient;

                IsPlayer = true;
                _startButton = new StartDrinkButton(_twoClient, this, -75, -10, _twoClient.Sf, twoClient.ButtonTexture);
                _closeButton = new CloseDrinkButton(_twoClient, this, -75, 90, _twoClient.Sf, twoClient.ButtonTexture);
                //_twoClient.SendMessage("DRINKSFORM " + delay);
                _drinkAnimation = new DrinkAnimation(twoClient, twoClient.WindowWidth / 2 - 215, twoClient.WindowHeight / 2 - 60, delay);
            IsActive = true;
            _playerName = _twoClient.PlayerList[_twoClient.PlayerNumber].Name;
            _dialogText = _twoClient.SplitText(385, toSay);
            TimeDelay = delay * 10000000;// NORMAL: 10000000;
            _progBar = new ProgressBar(_twoClient,_twoClient.WindowWidth/2-175,350,twoClient.WindowHeight /2, 15, 2);
            _bgRect = new CurvedRect(_twoClient, _twoClient.WindowWidth / 2 - 220, 440, _twoClient.WindowHeight / 2 - 40 - (25 * _dialogText.Count), 160 + (25 * _dialogText.Count), Color.LightBlue);
            OldGameState = twoClient.GameState;

            twoClient.GameState = 4;
        }