Пример #1
0
        static public CombatRoundResult CreateFromAzureString(String data)
        {
            CombatRoundResult roundResult = null;

            if (!String.IsNullOrEmpty(data))
            {
                roundResult = new CombatRoundResult();
                String[] armyStrings = data.Split('@');
                List <ICombatArmyRoundResult> armyResults = new List <ICombatArmyRoundResult>();
                for (int counter = 0; counter < armyStrings.Length; ++counter)
                {
                    armyResults.Add(CombatArmyRoundResult.CreateFromAzureString(armyStrings[counter]));
                }
                roundResult.ArmyResults = armyResults;
            }

            return(roundResult);
        }
Пример #2
0
        static public CombatArmyRoundResult CreateFromAzureString(String data)
        {
            CombatArmyRoundResult armyResult = null;

            if (!String.IsNullOrEmpty(data))
            {
                armyResult = new CombatArmyRoundResult();
                String[] armyStrings = data.Split('#');
                if (armyStrings.Length >= 3)
                {
                    armyResult.OriginRegionId = Guid.Parse(armyStrings[0]);
                    armyResult.OwnerUserId    = armyStrings[1];
                    armyResult.TroopsLost     = UInt32.Parse(armyStrings[2]);
                    List <UInt32> rolledResults = new List <UInt32>();
                    for (int counter = 3; counter < armyStrings.Length; ++counter)
                    {
                        rolledResults.Add(UInt32.Parse(armyStrings[counter]));
                    }
                    armyResult.RolledResults = rolledResults;
                }
            }

            return(armyResult);
        }