Esempio n. 1
0
 private void GameComplete(object sender, GameCompleteEventArgs args)
 {
     foreach (GameEvent newEvent in args.GameEvents)
     {
         GameEvents.Add(new GameEventVm(newEvent, m_teamLookup));
     }
 }
Esempio n. 2
0
        internal async Task AsyncLoadEvents(string eventsFile)
        {
            try
            {
                GameEvents.SupressNotification = true;
                m_stopwatch = new Stopwatch();
                m_stopwatch.Start();
                OnPropertyChanged(nameof(GameEventsDelayedCount));
                using (StreamReader sr = new StreamReader(eventsFile))
                {
                    while (!sr.EndOfStream)
                    {
                        string obj = await sr.ReadLineAsync();

                        GameEvent e = JsonSerializer.Deserialize <GameEvent>(obj, s_diskOptions);
                        GameEvents.Add(new GameEventVm(e, m_teamLookup));
                        if (m_stopwatch.Elapsed > TimeSpan.FromSeconds(COUNT_DELAY))
                        {
                            OnPropertyChanged(nameof(GameEventsDelayedCount));
                            m_stopwatch.Restart();
                        }
                    }
                }
                m_stopwatch.Stop();

                GameEvents.SupressNotification = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something invalid happened.", "BLASPHEMY");
            }
        }
Esempio n. 3
0
        public void AddEvent(GameEvent gameEvent)
        {
            gameEvent.Turn = Turn + 1;

            Logger.Info(TraceMessage.Execute(this, $"Add event.Turn = {gameEvent.Turn} Turn = {Turn}"));

            GameEvents.Add(gameEvent);
        }
Esempio n. 4
0
        public GameEvent LogEvent(string eventType, string team, string player, string notes)
        {
            GameEvent gameEvent = new GameEvent(DateTime.Now, eventType, team, player, notes);

            GameEvents.Add(gameEvent);
            FilterGameEvents();
            SaveGames();
            return(gameEvent);
        }
Esempio n. 5
0
 public async Task StartGame(ulong id, GameEvent game)
 {
     if (GameEvents.ContainsKey(id))
     {
         return;
     }
     GameEvents.Add(id, game);
     await Task.CompletedTask;
 }
Esempio n. 6
0
    void Awake()
    {
        if (Application.isPlaying)
        {
            if (Instance)
            {
                Destroy(this);
                return;
            }
        }
        Instance = this;

        GameEvents.Add("RESET", global::GameEvents.E_State.False);
    }
Esempio n. 7
0
        private async Task AsyncConvertUpdates()
        {
            Processor processor = new Processor();

            GameEvents.Clear();
            GameEvents.SupressNotification = true;
            foreach (GameUpdateVm vm in m_updatesCv)
            {
                GameEvent newEvent = processor.ProcessGame(vm.Update, vm.Update.timestamp);
                if (newEvent != null)
                {
                    GameEvents.Add(new GameEventVm(newEvent, m_teamLookup));
                }
            }
            GameEvents.SupressNotification = false;
        }
Esempio n. 8
0
 private void ApplyStatUpdates(GameObject gameObject, double delta)
 {
     if (gameObject is Character)
     {
         var character = gameObject as Character;
         if (character.IsDead)
         {
             if (character.StatusEffects.Find(x => x.Type == StatusEffectTypes.Dead).Expiration < DateTime.Now)
             {
                 character.StatusEffects.RemoveAll(x => x.Type == StatusEffectTypes.Dead);
                 character.CurrentEnergy = character.MaxEnergy;
                 character.XCoord        = character.AnchorX;
                 character.YCoord        = character.AnchorY;
                 character.ZCoord        = character.AnchorZ;
                 GameEvents.Add(new GameEvent()
                 {
                     EventName = "SoulReturned",
                     EventData = new Dictionary <string, dynamic>()
                     {
                         { "CharacterID", character.ID }
                     },
                     XCoord = character.XCoord,
                     YCoord = character.YCoord,
                     ZCoord = character.ZCoord
                 });
                 character.Modified = true;
             }
             return;
         }
         if (character.IsCharging)
         {
             character.CurrentCharge = Math.Min(character.MaxCharge, character.CurrentCharge + (delta * (character.MaxCharge / 40)));
             character.Modified      = true;
         }
     }
 }
Esempio n. 9
0
    public override void OnInspectorGUI()
    {
        GameBlackboard gb = target as GameBlackboard;

        if (Application.isPlaying)
        {
            OnInspectorGuiEx();
            return;
        }

        const float kFrameWidth  = 80;
        const float kDeleteWidth = 17;

        GUILayout.BeginVertical("OL box NoExpand");

        GUILayout.BeginHorizontal();
        GUILayout.Label("Game Events", "OL Title");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Name", "OL Title");
        GUILayout.Label("State", "OL Title", GUILayout.Width(kFrameWidth));
        GUILayout.Label(GUIContent.none, "OL Title", GUILayout.Width(kDeleteWidth));
        GUILayout.EndHorizontal();


        GUIStyle gs = "OL TextField";

        GameEvents events = gb.GameEvents;


        Dictionary <string, GameEvents.E_State> updatedEvents = new Dictionary <string, GameEvents.E_State>();



        for (int i = 0; i < events.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();

            string             key   = EditorGUILayout.TextField(events.Names[i], gs, GUILayout.MinWidth(30));
            GameEvents.E_State state = (GameEvents.E_State)EditorGUILayout.EnumPopup(events.GetState(events.Names[i]), GUILayout.Width(kFrameWidth));

            if (GUILayout.Button(GUIContent.none, "OL Minus", GUILayout.Width(kDeleteWidth)) == false)
            {
                try { updatedEvents.Add(key, state); }
                catch { updatedEvents.Add(events.Names[i], events.GetState(events.Names[i])); }
            }

            EditorGUILayout.EndHorizontal();
        }

        GUILayout.Space(5);
        GUILayout.BeginHorizontal();

        if (GUILayout.Button(GUIContent.none, "OL Plus", GUILayout.Width(kDeleteWidth)))
        {
            updatedEvents.Add("_NewEvent" + events.Count, GameEvents.E_State.False);
        }

        if (GUI.changed || events.Count != updatedEvents.Count)
        {
            //gb.ClearAllGameEvents();

            events.Clear();

            foreach (KeyValuePair <string, GameEvents.E_State> pair in updatedEvents)
            {
                events.Add(pair.Key, pair.Value);
            }

            EditorUtility.SetDirty(gb);
        }


        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
    }
Esempio n. 10
0
 private void RegisterGameEvents()
 {
     GameEvents.Add("KEYTAKEN", RemoveKey);
     GameEvents.Add("KEYUSED", UnlockDoor);
 }
Esempio n. 11
0
 public static void AddEvent(PlayerPosition player, string eventKey)
 {
     gameEvents.Add(player, eventKey);
 }