Ejemplo n.º 1
0
        public CharacterCollection GetCharacter(int id, string motionName)
        {
            if (!CharacterIDList.Contains(id))
            {
                return(null);
            }

            var wz_nodes = CharacterNode.Nodes.ToList().FindAll(node => FormatID(node.Text) == id);

            if (wz_nodes.Count == 0)
            {
                return(null);
            }

            var headNode = wz_nodes.Find(node => node.Text.StartsWith("0001")).GetImageNode();
            var bodyNode = wz_nodes.Find(node => node.Text.StartsWith("0000")).GetImageNode();

            if (headNode == null || bodyNode == null)
            {
                return(null);
            }

            CharacterCollection character = new CharacterCollection
            {
                Id         = id,
                HeadInfo   = headNode.GetCharacterInfo(CharacterNode),
                HeadMotion = headNode.Nodes[motionName]?.GetCharacterMotion(CharacterNode, ConfigType.Head),
                BodyInfo   = bodyNode.GetCharacterInfo(CharacterNode),
                BodyMotion = bodyNode.Nodes[motionName]?.GetCharacterMotion(CharacterNode, ConfigType.Body),
            };

            return(character);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 类型:方法
        /// 名称:Setup
        /// 作者:taixihuase
        /// 作用:启动并初始化客户端
        /// 编写日期:2015/7/12
        /// </summary>
        protected override void Setup()
        {
            // 创建日志
            GlobalContext.Properties["Photon:ApplicationLogPath"] = Path.Combine(ApplicationRootPath, "log");

            string path = Path.Combine(BinaryPath, "log4net.config");
            var    file = new FileInfo(path);

            if (file.Exists)
            {
                LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance);
                XmlConfigurator.ConfigureAndWatch(file);
            }

            Log.Debug(DateTime.Now + " : Server is running");

            // 初始化数据库操作列表
            Data = new DatabaseCollection(this);

            // 初始化用户列表
            Users = new UserCollection(this);

            // 初始化玩家角色列表
            Characters = new CharacterCollection(this);
        }
Ejemplo n.º 3
0
 public IFFFile(string filename)
 {
     FileName            = filename;
     Part                = new PartCollection();
     Card                = new CardCollection();
     Caddie              = new CaddieCollection();
     Item                = new ItemCollection();
     LevelUpPrizeItem    = new LevelUpPrizeItemCollection();
     Character           = new CharacterCollection();
     Ball                = new BallCollection();
     Ability             = new AbilityCollection();
     Skin                = new SkinCollection();
     CaddieItem          = new CaddieItemCollection();
     Club                = new ClubCollection();
     ClubSet             = new ClubSetCollection();
     Course              = new CourseCollection();
     CutinInformation    = new CutinInformationCollection();
     Desc                = new DescCollection();
     Furniture           = new FurnitureCollection();
     FurnitureAbility    = new FurnitureAbilityCollection();
     Mascot              = new MascotCollection();
     TikiSpecialTable    = new TikiSpecialTableCollection();
     TikiRecipe          = new TikiRecipeCollection();
     TikiPointTable      = new TikiPointTableCollection();
     CadieMagicBox       = new CadieMagicBoxCollection();
     CadieMagicBoxRandom = new CadieMagicBoxRandomCollection();
     HairStyle           = new HairStyleCollection();
     Match               = new MatchCollection();
     SetItem             = new SetItemCollection();
     Enchant             = new EnchantCollection();
     Achievement         = new AchievementCollection();
     AuxPart             = new AuxPartCollection();
 }
Ejemplo n.º 4
0
 public IFFFile()
 {
     Card         = new CardCollection();
     Items        = new ItemCollection();
     SetItem      = new SetItemCollection();
     Character    = new CharacterCollection();
     HairStyle    = new HairStyleCollection();
     Club         = new ClubSetCollection();
     Caddie       = new CaddieCollection();
     Skin         = new SkinCollection();
     CaddieItem   = new CaddieItemCollection();
     Mascot       = new MascotCollection();
     CutinInfo    = new CutinInfoCollection();
     GrandPrix    = new GrandPrixDataCollection();
     LevelPrize   = new LevelUpPrizeItemCollection();
     Ball         = new BallCollection();
     GPSpecial    = new GrandPrixSpecialHoleCollection();
     GPReward     = new GrandPrixRankRewardCollection();
     MemorialRare = new MemorialShopRareItemCollection();
     MemorialCoin = new MemorialShopCoinItemCollection();
     MgicBox      = new CadieMagicCollection();
     AuxPart      = new AuxPartCollection();
     Desc         = new DescCollection();
     Part         = new PartCollection();
 }
Ejemplo n.º 5
0
            public void LoadField(out Field cellField, out Player player, out CharacterCollection enemies)
            {
                cellField = new Field(field[0].Length, field.Length);
                enemies   = new CharacterCollection();
                player    = new Player(0, 0);
                for (int y = 0; y < field.Length; y++)
                {
                    for (int x = 0; x < field[y].Length; x++)
                    {
                        switch (field[y][x])
                        {
                        case '#':
                            cellField[x, y] = new Wall();
                            break;

                        case ' ':
                            cellField[x, y] = new Empty();
                            break;

                        case 'E':
                            enemies.Add(new Enemy(x, y));
                            goto case ' ';

                        case 'P':
                            player = new Player(x, y);
                            goto case ' ';

                        default:
                            cellField[x, y] = new DestroyedObject();
                            break;
                        }
                    }
                }
            }
Ejemplo n.º 6
0
 public void Visit(CharacterCollection collection)
 {
     foreach (var character in collection.Characters)
     {
         character.Accept(this);
         Console.WriteLine();
     }
 }
Ejemplo n.º 7
0
 private void StartTurn()
 {
     foreach (CharacterModel character in CharacterCollection.Where(c => c.Owner == ActivePlayer))
     {
         character.StartTurn();
     }
     ActivePlayer.StartTurn();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Demonstrates using the visitor pattern on classes that uses interfaces
        /// </summary>
        public void PerformVisitOnCharacters()
        {
            var collection = new CharacterCollection();

            var characterVisitor = new CharacterVisitor();

            characterVisitor.Visit(collection);
        }
Ejemplo n.º 9
0
        private void ImportImperatorCountry(
            Country country,
            CountryCollection imperatorCountries,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            NicknameMapper nicknameMapper,
            CharacterCollection characters,
            Date conversionDate
            )
        {
            // Create a new title or update existing title
            var name = DetermineName(country, imperatorCountries, tagTitleMapper, locDB);

            if (TryGetValue(name, out var existingTitle))
            {
                existingTitle.InitializeFromTag(
                    country,
                    imperatorCountries,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
            }
            else
            {
                Add(
                    country,
                    imperatorCountries,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    tagTitleMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
            }
        }
        public void AddCharacterNoSpecializationTest()
        {
            //Arrange
            CharacterCollection characterCollection = new CharacterCollection(new CharacterMemoryContext());
            Character           character           = new Character(0, "John", DateTime.Now, "", 200);

            //Act & Assert (Expects an Exception)
            characterCollection.AddCharacter(character);
        }
        public void AddCharacterNameTooLongTest()
        {
            //Arrange
            CharacterCollection characterCollection = new CharacterCollection(new CharacterMemoryContext());
            Character           character           = new Character(0, Guid.NewGuid().ToString(), DateTime.Now, "Paladin", 200);

            //Act & Assert (Expects an Exception)
            characterCollection.AddCharacter(character);
        }
Ejemplo n.º 12
0
        protected CharactersInGroupVM(CharacterCollection collection)
        {
            Collection = collection;

            CharacterText = new TextVM(GameTexts.FindText("str_ebt_character"));
            Characters    = new SelectorVM <SelectorItemVM>(0, null);

            Character = CharacterConfigVM.Create(Collection.IsMultiplayer);
        }
Ejemplo n.º 13
0
    public static void Create()
    {
        CharacterCollection characterList = ScriptableObject.CreateInstance <CharacterCollection>();

        AssetDatabase.CreateAsset(characterList, "Assets/CharacterCollection.asset");
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = characterList;
    }
Ejemplo n.º 14
0
 public AreaSyncData GetAreaSyncData(string areaId)
 {
     return(new AreaSyncData()
     {
         Area = AreaCollection.FindById(areaId),
         Characters = CharacterCollection.FindCharacterOnArea(areaId),
         Sections = SectionCollection.FindAllSectionsByArea(areaId)
     });
 }
Ejemplo n.º 15
0
 public void SpellCast(Ability spell, CharacterCollection allies, EnemyCollection enemies)
 {
     playerCasting = true;
     while (playerCasting == true)
     {
         if (spell.targetOption == AbilityTargetOption.SELF)
         {
             Enqueue(spell, new Character(), new Vector3());
             playerCasting = false;
         }
         else if (spell.targetOption == AbilityTargetOption.TARGET_ALLY)
         {                   //for now, targeting based on pressing numbers - will implement click-targeting
             if (Input.GetButtonDown("Ability 1"))
             {
                 Enqueue(spell, allies.getHero(0), new Vector3());
                 playerCasting = false;
             }
             else if (Input.GetButtonDown("Ability 2"))
             {
                 Enqueue(spell, allies.getHero(1), new Vector3());
                 playerCasting = false;
             }
             else if (Input.GetButtonDown("Ability 3"))
             {
                 Enqueue(spell, allies.getHero(2), new Vector3());
                 playerCasting = false;
             }
         }
         else if (spell.targetOption == AbilityTargetOption.TARGET_ENEMY)
         {
             if (Input.GetButtonDown("Ability 1"))
             {
                 Enqueue(spell, enemies.getEnemy(0), new Vector3());
                 playerCasting = false;
             }
             else if (Input.GetButtonDown("Ability 2"))
             {
                 Enqueue(spell, enemies.getEnemy(1), new Vector3());
                 playerCasting = false;
             }
             else if (Input.GetButtonDown("Ability 3"))
             {
                 Enqueue(spell, enemies.getEnemy(2), new Vector3());
                 playerCasting = false;
             }
         }
         else if (spell.targetOption == AbilityTargetOption.TARGET_LOCATION)
         {
         }
         else if (spell.targetOption == AbilityTargetOption.NONE)
         {
             Enqueue(spell, new Character(), new Vector3());
             playerCasting = false;
         }
     }
 }
Ejemplo n.º 16
0
        static void ShowAllChars(CharacterCollection charCollection)
        {
            var allChars = charCollection.Results.ToList();

            foreach (var character in allChars)
            {
                Console.WriteLine($"Id: {character.Id}");
                Console.WriteLine($"Name: {character.Name}");
            }
        }
Ejemplo n.º 17
0
    public static void OutputCharacters(string outputModName, CharacterCollection characters, Date conversionDate)
    {
        // dumping all into one file
        var path = $"output/{outputModName}/history/characters/fromImperator.txt";

        using var stream = File.OpenWrite(path);
        using var output = new StreamWriter(stream, System.Text.Encoding.UTF8);
        foreach (var character in characters)
        {
            CharacterOutputter.OutputCharacter(output, character, conversionDate);
        }
    }
Ejemplo n.º 18
0
 static public CharacterCollection.CharacterModel GetUnlockedCharacter()
 {
     foreach (CharacterCollection.CharacterModel character in CharacterCollection.GetAllCharacters())
     {
         if (character.locked == true && GetStat(character.unlockKey) >= character.unlockValue)
         {
             Debug.Log(character.displayName + " unlocked!");
             return(character);
         }
     }
     return(null);
 }
        public void ConvertCharacterDTOFailTest()
        {
            //Arrange
            CharacterCollection characterCollection = new CharacterCollection(new CharacterMemoryContext());
            DateTime            date      = DateTime.Now;
            CharacterDTO        character = new CharacterDTO(0, "John", date, "Paladin", 200);
            //Act
            Character convertedCharacter = characterCollection.ConvertCharacter(character);

            //Assert
            Assert.AreNotEqual(new Character(0, "John", date, "Wizard", 200), convertedCharacter);
        }
Ejemplo n.º 20
0
        public void Initialize(ScreenBase screen, CharacterCollection characterCollection, bool isMultiplayer)
        {
            if (!_isInitialized)
            {
                _isInitialized       = true;
                _screen              = screen;
                _characterCollection = characterCollection;
                _dataSource          = new CharacterSelectionVM(_characterCollection, BeginSelection, EndSelection, isMultiplayer);
            }

            _isActive = false;
        }
Ejemplo n.º 21
0
        private bool SaveReloadAll_CanExecute()
        {
            CharacterCollection collection = CharactersControl.DataContext as CharacterCollection;

            if (collection == null)
            {
                return(false);
            }
            var hasChanges = collection.Characters.Where(model => model.HasChanges);

            return(hasChanges.Any());
        }
Ejemplo n.º 22
0
        private void CameraButton_Click(object sender, EventArgs e)
        {
            _soundEngine.PlaySound(global::FNAF.Properties.Resources.VariousFNAFSound);
            Button button = (Button)sender;

            CharacterCollection characters = GetCharacters(button);

            FormBase form = GetForm(button);

            FormBase parent = GetParentForm();

            ThreadingEngine.GetThread <GameEngine>().UpdateForm(parent, form);
        }
Ejemplo n.º 23
0
        public static CharacterCollection DeserializeCharacterCollection(string xmlPath)
        {
            CharacterCollection tempCollection = null;

            XmlSerializer serializer = new XmlSerializer(typeof(CharacterCollection));

            StreamReader reader = new StreamReader(xmlPath);

            tempCollection = (CharacterCollection)serializer.Deserialize(reader);
            reader.Close();

            return(tempCollection);
        }
        public void AddCharacterTest()
        {
            //Arrange
            CharacterCollection characterCollection = new CharacterCollection(new CharacterMemoryContext());
            Character           character           = new Character(0, "John", DateTime.Now, "Paladin", 200);

            //Act
            characterCollection.AddCharacter(character);
            //Assert
            bool addCharacter = characterCollection.AddCharacter(character);

            Assert.AreEqual(addCharacter, true);
        }
Ejemplo n.º 25
0
        private void LoadCustomDir_Execute(bool subdirs)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog
            {
                Description         = "Select Directory to Load",
                ShowNewFolderButton = false,
                SelectedPath        = Core.EditSaveDir,
            };

            if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            SeatDataBlock.ResetSeats();
            CharacterCollection collection = DataContext as CharacterCollection;

            if (collection != null)
            {
                while (!collection.ViewModelProvider.Finish())
                {
                    MessageBoxResult msg = MessageBox.Show(MESSAGE_ERROR_FINISH_PROVIDER,
                                                           "Error",
                                                           MessageBoxButton.OKCancel,
                                                           MessageBoxImage.Hand);
                    if (msg == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }
                collection.ViewModelProvider.Dispose();
            }

            ICharacterViewModelProvider viewModelProvider = subdirs
                ? new FileSystemCharacterViewModelProvider(true, fbd.SelectedPath)
                : new FileSystemCharacterViewModelProvider(false, fbd.SelectedPath);

            viewModelProvider.Initialize(this);

            viewModelProvider.CharacterLoaded += ViewModelProviderOnCharacterLoaded;
            CharacterCollection characterCollection = new CharacterCollection(Dispatcher, viewModelProvider);

            viewModelProvider.CharacterLoaded -= ViewModelProviderOnCharacterLoaded;
            SetTitle();
            DataContext = characterCollection;

            SortBox.SelectedValue           = viewModelProvider.DefaultSortProperty;
            OrderBox.SelectedValue          = viewModelProvider.DefaultSortDirection;
            CharactersControl.SelectedIndex = 0;
        }
Ejemplo n.º 26
0
        public void RemovePlayerFromTheGame(string connectionId)
        {
            logService.Log($"Tring to remove player with connection id from the server {connectionId}");
            var playerData = PlayerCollection.FindByConnectionId(connectionId);

            if (playerData == null)
            {
                logService.Log($"Wasn't able to find any player with connection id {connectionId}");
                return;
            }

            PlayerCollection.RemovePlayer(playerData.PlayerName);
            CharacterCollection.RemovePlayerCharacters(playerData.PlayerName);
        }
Ejemplo n.º 27
0
        private void SaveAll_Execute()
        {
            CharacterCollection collection = CharactersControl.DataContext as CharacterCollection;

            if (collection == null)
            {
                return;
            }
            var hasChanges = collection.Characters.Where(model => model.HasChanges);

            foreach (CharacterViewModel model in hasChanges)
            {
                model.SaveCommand.Execute(null);
            }
        }
Ejemplo n.º 28
0
 public void OnFinalize()
 {
     if (!_isInitialized)
     {
         return;
     }
     _isInitialized       = false;
     _screen              = null;
     _isActive            = false;
     _characterCollection = null;
     _dataSource.OnFinalize();
     _dataSource    = null;
     _gauntletLayer = null;
     _movie         = null;
 }
Ejemplo n.º 29
0
 void HandleAddPlayer()
 {
     text.text = startText;
     if (Input.GetButtonDown("Start_P" + playerNumber) || Input.GetButtonDown("Throw_P" + playerNumber))
     {
         currentCharacter = CharacterCollection.GetFirstOpenCharacter(playerNumber);
         GameObject newPlayer = Instantiate(playerObject, new Vector3(transform.position.x, transform.position.y - 40, 0), Quaternion.identity) as GameObject;
         newPlayerController = newPlayer.GetComponent <CharacterSelectController>();
         newPlayerController.SetCharacter(currentCharacter);
         newPlayerController.playerNumber = playerNumber;
         _state = State.SELECTING;
         gameObject.GetComponent <Blink>().StopBlink();
         PlaySound(joinSound);
     }
 }
        public SPCharactersInGroupVM(CharacterCollection collection) : base(collection)
        {
            OccupationText = new TextVM(new TextObject("{=GZxFIeiJ}Occupation"));
            for (Occupation occupation = Occupation.NotAssigned;
                 occupation < Occupation.NumberOfOccupations;
                 ++occupation)
            {
                _occupations.Add(occupation);
            }

            Occupations = new SelectorVM <SelectorItemVM>(0, OnSelectedOccupationChanged);
            var list = new MBBindingList <SelectorItemVM>();

            foreach (var item in
                     _occupations.Select(occupation =>
            {
                switch (occupation)
                {
                case Occupation.GoodsTrader:
                case Occupation.BannerBearer:
                    return(new TextObject(occupation.ToString()));

                case Occupation.Outlaw:
                    return(GameTexts.FindText("str_outlaw"));

                case Occupation.RuralNotable:
                    return(GameTexts.FindText("str_rural_notable"));

                case Occupation.Artisan:
                case Occupation.Preacher:
                case Occupation.Headman:
                case Occupation.GangLeader:
                    return(GameTexts.FindText("str_charactertype_" + occupation.ToString().ToLower()));

                case Occupation.Judge:
                    return(new TextObject("{=ZRkceJx3}Judge"));

                case Occupation.CaravanGuard:
                    return(new TextObject("{=jxNe8lH2}Caravan Guard"));
                }
                return(GameTexts.FindText("str_occupation", occupation.ToString()));
            }))
            {
                list.Add(new SelectorItemVM(item));
            }

            Occupations.ItemList = list;
        }
    private char[] TextArray; // The text of the document.

    #endregion Fields

    #region Constructors

    public Document(string initialText)
    {
        TextArray = initialText.ToCharArray();
        Words = new WordCollection(this);
        Characters = new CharacterCollection(this);
    }