예제 #1
0
    public Game(IGameListener listener, Settings settings, string avatarName)
    {
        this.listener = listener;
        this.settings = settings;

        this.stateStrategy = Disconnected.Instance;
    }
예제 #2
0
 public ListenerManager(IGameListener listener, EventType type, GameObject gm, bool autoListen = false)
 {
     this.listener = listener;
     this.type = type;
     this.gm = gm;
     if (autoListen)
         StartListening();
 }
예제 #3
0
 public Player(IPlayer player, IGameListener listener, Board board, AvailableTribes availableTribes, Dice dice)
 {
     if (player == null)
     {
         throw new ArgumentNullException("player");
     }
     _player          = player;
     _listener        = listener;
     _board           = board;
     _availableTribes = availableTribes;
     _dice            = dice;
 }
예제 #4
0
        public Game(IGameListener listener, List <Player> players, Room room)
        {
            _listener   = listener;
            Uuid        = Guid.NewGuid().ToString();
            Players     = players;
            _turnPlayer = players.First();
            Room        = room;

            _currentCards = new Tuple <string, int>[4] {
                Tuple.Create <string, int>("ZUCCHINI", 0),
                Tuple.Create <string, int>("ZUCCHINI", 0),
                Tuple.Create <string, int>("ZUCCHINI", 0),
                Tuple.Create <string, int>("ZUCCHINI", 0)
            };
        }
    //the function to add a game listener to the array of game listeners
    public void AddGameListener(EventType eventType, IGameListener gameListener)
    {
        //the list of game listeners for this event
        List <IGameListener> listenList = null;

        //check for an existing event type key, and if it exists add to that list
        if (GameListeners.TryGetValue(eventType, out listenList))
        {
            listenList.Add(gameListener);
            return;
        }

        //otherwise create a new list as a dictionary key
        listenList = new List <IGameListener>();
        listenList.Add(gameListener);
        GameListeners.Add(eventType, listenList);
    }
예제 #6
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Game" /> class.
        /// </summary>
        /// <param name = "listener">
        ///   The listener.
        /// </param>
        /// <param name = "settings">
        ///   The settings.
        /// </param>
        /// <param name = "avatarName">
        ///   The avatar Name.
        /// </param>
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(Guid.NewGuid().ToString(), (byte)ItemType.Avatar, this, avatarName);
            this.avatar.AddVisibleInterestArea(0);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
            {
                TopLeftCorner     = new[] { -2000f, -2000f },
                BottomRightCorner = new float[] { this.settings.GridSize[0], this.settings.GridSize[1] },
                Name           = this.settings.WorldName,
                TileDimensions = new float[] { this.settings.TileDimensions[0], this.settings.TileDimensions[1] }
            };

            this.stateStrategy = Disconnected.Instance;
        }
예제 #7
0
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(this, Guid.NewGuid().ToString(), ItemType.Avatar, avatarName);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
                {
                    BoundingBox = new BoundingBox
                    {
                        Min = new Vector(),
                        Max = new Vector(settings.GridSize.X, settings.GridSize.Y)
                    },
                    Name = this.settings.WorldName,
                    TileDimensions = this.settings.TileDimensions
                };
        }
예제 #8
0
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(this, Guid.NewGuid().ToString(), ItemType.Avatar, avatarName);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
            {
                BoundingBox = new BoundingBox
                {
                    Min = new Vector(),
                    Max = new Vector(settings.GridSize.X, settings.GridSize.Y)
                },
                Name           = this.settings.WorldName,
                TileDimensions = this.settings.TileDimensions
            };
        }
예제 #9
0
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(this, Guid.NewGuid().ToString().Substring(0, 4), ItemType.Avatar, avatarName);
            listener.LogInfo("Game IGameListener Initialized: " + this.avatar.Id);
            Debug.WriteLine("Game IGameListener Initializing: " + this.avatar.Id);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
            {
                BoundingBox = new BoundingBox
                {
                    Min = new Vector(),
                    Max = new Vector(settings.GridSize.X, settings.GridSize.Y)
                },
                Name           = this.settings.WorldName,
                TileDimensions = this.settings.TileDimensions
            };
        }
예제 #10
0
 /*
  * Add an application listener to server, used to forward non-library internals events
  */
 public void SetListeners(IAppListener appListener, IGameListener gameListener)
 {
     ssManager         = new NetManager(new SSListener());
     csManager         = new NetManager(new CSListener(appListener));
     this.gameListener = gameListener;
 }
예제 #11
0
 public void Initialize(IGameListener listener, GameData.DataSlot dataSlot)
 {
     gameListener  = listener;
     this.dataSlot = dataSlot;
 }
예제 #12
0
 public void AddGameListener(IGameListener listener)
 {
     listeners.Add(listener);
 }
예제 #13
0
 /// <summary>
 /// Unregisters a game listener.
 /// </summary>
 /// <param name="aListener"></param>
 public static void Unregister(IGameListener aListener)
 {
     if (aListener != null && instance != null )
     {
         instance.m_GameListeners.Remove(aListener);
     }
 }
예제 #14
0
 /// <summary>
 /// Registers a game listener for pause / unpause / reset events.
 /// </summary>
 /// <param name="aListener"></param>
 public static void Register(IGameListener aListener)
 {
     if(aListener != null && !instance.m_GameListeners.Contains(aListener))
     {
         instance.m_GameListeners.Add(aListener);
     }
 }
예제 #15
0
 public GameMaster(IGameListener gameListener)
 {
     players           = new List <Player>();
     this.gameListener = gameListener;
 }
예제 #16
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Game" /> class.
        /// </summary>
        /// <param name = "listener">
        ///   The listener.
        /// </param>
        /// <param name = "settings">
        ///   The settings.
        /// </param>
        /// <param name = "avatarName">
        ///   The avatar Name.
        /// </param>
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(Guid.NewGuid().ToString(), (byte)ItemType.Avatar, this, avatarName);
            this.avatar.AddVisibleInterestArea(0);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
                {
                    TopLeftCorner = new[] { 1f, 1f }, 
                    BottomRightCorner = new float[] { this.settings.GridSize[0], this.settings.GridSize[1] }, 
                    Name = this.settings.WorldName, 
                    TileDimensions = new float[] { this.settings.TileDimensions[0], this.settings.TileDimensions[1] }
                };

            this.stateStrategy = Disconnected.Instance;
        }
예제 #17
0
 public void Initialize(IGameListener listener, GameData.DataSlot dataSlot)
 {
     gameListener = listener;
     this.dataSlot = dataSlot;
 }
예제 #18
0
 public Game(IGameListener listener)
 {
     _listener = listener;
 }
 internal GameListenerProxy(IGameListener listener)
     : base("com.google.service.game.IGameListener")
 {
     this.listener = listener;
 }