예제 #1
0
        public void GenerateKeyBindsForEvent_CreatesProperKeybindString()
        {
            string actual = string.Empty;
            string valid  = string.Empty;

            foreach (GameEvent evt in Enum.GetValues(typeof(GameEvent)))
            {
                actual = keyBindsGenerator.GenerateKeyBindsForEvent(evt);
                valid  = keyBindsGenerator.keyBindsStrings[evt];

                Assert.AreEqual(valid, actual);
                keyBindsGenerator.CompleteEvent();
            }
        }
예제 #2
0
        private void DisplayAttackMenu()
        {
            KeyBindsGenerator keyBindsGenerator = new KeyBindsGenerator();

            keyBindsGenerator.GenerateKeyBindsForEvent(GameEvent.PopMenu, "attack");
            keyBindsGenerator.CompleteEvent();
        }
예제 #3
0
        public void DisplayMenu()
        {
            KeyBindsGenerator keyBindsGenerator = new KeyBindsGenerator();

            keyBindsGenerator.GenerateKeyBindsForEvent(GameEvent.PopMenu, "character");
            keyBindsGenerator.CompleteEvent();
        }
예제 #4
0
        public string Render(bool completeEvent = true, Character Target = null)
        {
            string keybind = string.Empty;

            if (completeEvent)
            {
                if (AnimationOnLoad != null)
                {
                    if (Type == IdentityType.Costume)
                    {
                        AnimationOnLoad.PlayOnLoad(false, Target, Surface);
                    }
                    else
                    {
                        AnimationOnLoad.Play(playAsSequence: true);
                    }
                }
            }
            switch (Type)
            {
            case IdentityType.Model:
            {
                keybind = keyBindsGenerator.GenerateKeyBindsForEvent(GameEvent.BeNPC, Surface);
                break;
            }

            case IdentityType.Costume:
            {
                if (AnimationOnLoad != null)
                {
                    var target = Target ?? AnimationOnLoad.Owner;
                    target.Target(false);
                }
                keybind = keyBindsGenerator.GenerateKeyBindsForEvent(GameEvent.LoadCostume, Surface);
                break;
            }
            }
            if (completeEvent)
            {
                keybind = keyBindsGenerator.CompleteEvent();
                if (Target != null && Type == IdentityType.Model)
                {
                    Target.SuperImposeGhost();
                }
            }
            return(keybind);
        }
예제 #5
0
        public void GenerateKeyBindsForEvent_PlacesKeybindInTempBindFile()
        {
            // THIS CANNOT POSSIBLY BE TESTED WITH MOCK AS IT CONTAINS ACTUAL FILE I/O. WE SHOULD USE AN ACTUAL INSTANCE OF KeyBindsGenerator
            keyBindsGenerator = new KeyBindsGenerator();
            //Act
            keyBindsGenerator.GenerateKeyBindsForEvent(GameEvent.SpawnNpc, testCrowdMember.ActiveIdentity.Surface, testCrowdMember.Name);

            keyBindsGenerator.CompleteEvent();

            StreamReader actualFile = new StreamReader(keyBindsGenerator.BindFile);
            string       actual     = actualFile.ReadLine();

            actualFile.Close();

            //Assert
            string valid = string.Format("{2} \"spawn_npc {0} {1}\"", testCrowdMember.ActiveIdentity.Surface, testCrowdMember.Name, keyBindsGenerator.TriggerKey);

            Assert.AreEqual(valid, actual);

            keyBindsGenerator = new Mock <KeyBindsGenerator>().Object;
        }