コード例 #1
0
        /// <summary>
        /// Add actor with initial score to pool of players.
        /// </summary>
        /// <param name="actorNr"></param>
        /// <param name="score"></param>
        public void AddPlayer(int actorNr, int score)
        {
            string userId = host.GameActors.ToList().Find(a => a.ActorNr == actorNr).UserId;

            scores.Add(actorNr, disconects.ContainsKey(userId) ? disconects[userId] : score);
            //host.BroadcastEvent(new List<int> { actorNr }, 0, (byte)Event.scoreSet, new Dictionary<byte, object>() { { (byte)0, scores } }, CacheOperations.DoNotCache);
            host.BroadcastEvent(ReciverGroup.All, 0, 0, (byte)Event.scoreSet, new Dictionary <byte, object>()
            {
                { (byte)0, scores }
            }, CacheOperations.DoNotCache);
        }
コード例 #2
0
        public void Start()
        {
            log.DebugFormat("TurnManager.Start called for game '{0}'.", pluginHost.GameId);

            pluginHost.BroadcastEvent(new List <int> {
                CurrentActor.ActorNr
            }, 0, (int)Event.StartTurn, null, 0);
            timer = pluginHost.CreateOneTimeTimer(() => NextTurn(), turnDuration);
            OnPlayerChanged();
        }
コード例 #3
0
        public static void RaiseEvent(this IPluginHost pluginHost, byte eventCode, object eventData, IList <int> targetActorsNumbers,
                                      int senderActorNumber     = 0,
                                      byte cachingOption        = CacheOperations.DoNotCache,
                                      SendParameters sendParams = default)
        {
            Dictionary <byte, object> parameters = new Dictionary <byte, object>(2)
            {
                { 245, eventData },
                { 254, senderActorNumber }
            };

            pluginHost.BroadcastEvent(targetActorsNumbers, senderActorNumber, eventCode, parameters, cachingOption, sendParams);
        }
コード例 #4
0
        public static void RaiseEvent(this IPluginHost pluginHost, byte eventCode, object eventData,
                                      byte receiverGroup        = ReciverGroup.All,
                                      int senderActorNumber     = 0,
                                      byte cachingOption        = CacheOperations.DoNotCache,
                                      byte interestGroup        = 0,
                                      SendParameters sendParams = default)
        {
            Dictionary <byte, object> parameters = new Dictionary <byte, object>(2)
            {
                { 245, eventData },
                { 254, senderActorNumber }
            };

            pluginHost.BroadcastEvent(receiverGroup, senderActorNumber, interestGroup, eventCode, parameters, cachingOption, sendParams);
        }