public void Verify(string fileName)
        {
            StaRTSLogger staRTSLogger = Service.Get <StaRTSLogger>();

            staRTSLogger.Debug("Using data path: " + fileName);
            string text = FileUtils.Read(FileUtils.GetAbsFilePathInMyDocuments(fileName, "/src/maps"));

            staRTSLogger.Debug("Read json: " + text);
            CombatEncounter data = this.Deserialize(text);

            staRTSLogger.Debug("De-serialized json to model...");
            string text2 = this.Serialize(data);

            staRTSLogger.Debug("Serialized model to json...");
            FileUtils.Write(FileUtils.GetAbsFilePathInMyDocuments(fileName, "/src/maps"), text2);
            staRTSLogger.Debug("Saved json: " + text2);
            text  = text.Replace(" ", string.Empty).Trim();
            text2 = text2.Replace(" ", string.Empty).Trim();
            if (text.Equals(text2))
            {
                staRTSLogger.Debug("Verification passed");
                return;
            }
            staRTSLogger.Debug(text);
            staRTSLogger.Debug(text2);
            staRTSLogger.Debug("Verification failed");
        }
예제 #2
0
 public Dispatcher(string url, MonoBehaviour engine, bool pickupMessages, IResponseHandler responseHandler)
 {
     this.url             = url;
     this.engine          = engine;
     this.pickupMessages  = pickupMessages;
     this.SuccessStatuses = new HashSet <uint>();
     this.SuccessStatuses.Add(0u);
     this.SuccessStatuses.Add(5001u);
     this.SuccessStatuses.Add(6300u);
     this.AuthKey          = "";
     this.LastLoginTime    = 0u;
     this.responseHandler  = responseHandler;
     this.syncDispatchLock = false;
     this.logger           = Service.Get <StaRTSLogger>();
     this.qcc     = Service.Get <QuietCorrectionController>();
     this.headers = this.GetDeviceInfoHeaders();
 }
예제 #3
0
 public AudioManager(AssetsCompleteDelegate onComplete)
 {
     Service.Set <AudioManager>(this);
     this.logger = Service.Get <StaRTSLogger>();
     this.sdc    = Service.Get <IDataController>();
     new AudioEventManager(this);
     this.audioObject = new GameObject("Audio");
     this.audioObject.AddComponent <AudioListener>();
     this.audioObject.transform.position = Vector3.zero;
     this.audioSources = new Dictionary <AudioCategory, AudioSource>();
     this.audioSources[AudioCategory.Effect]   = this.CreateAudioSource(128);
     this.audioSources[AudioCategory.Music]    = this.CreateAudioSource(0);
     this.audioSources[AudioCategory.Ambience] = this.CreateAudioSource(10);
     this.audioSources[AudioCategory.Dialogue] = this.CreateAudioSource(20);
     this.loadedAudio       = new Dictionary <AudioTypeVO, AudioData>();
     this.fadeOutDictionary = new Dictionary <AudioSource, AudioFader>();
     this.battleAudioFlags  = new bool[8];
     this.lastPlayed        = new AudioTypeVO[4];
     this.RefreshVolume();
     this.PreloadAudioAssets(onComplete);
 }
        private void ResetAttackFSM(SmartEntity troopEntity)
        {
            StaRTSLogger   staRTSLogger = Service.Get <StaRTSLogger>();
            StateComponent stateComp    = troopEntity.StateComp;

            if (stateComp == null)
            {
                staRTSLogger.Error("ResetAttackFSM StateComp is null");
                return;
            }
            stateComp.Reset();
            TroopComponent troopComp = troopEntity.TroopComp;

            if (troopComp == null)
            {
                staRTSLogger.Error("ResetAttackFSM TroopComp is null");
                return;
            }
            ITroopDeployableVO troopType = troopComp.TroopType;

            if (troopType == null)
            {
                staRTSLogger.Error("ResetAttackFSM TroopVO is null");
                return;
            }
            HealthType       healthType  = troopType.IsHealer ? HealthType.Healing : HealthType.Damaging;
            ShooterComponent shooterComp = troopEntity.ShooterComp;

            if (shooterComp == null)
            {
                staRTSLogger.Error("ResetAttackFSM ShooterComp is null");
                return;
            }
            shooterComp.Reset();
            shooterComp.AttackFSM = new AttackFSM(Service.Get <BattleController>(), troopEntity, troopEntity.StateComp, shooterComp, troopEntity.TransformComp, healthType);
        }
예제 #5
0
        private void SpawnProjectile(uint id, object cookie)
        {
            SpecialAttack specialAttack = (SpecialAttack)cookie;
            StaRTSLogger  staRTSLogger  = Service.Get <StaRTSLogger>();

            if (specialAttack == null)
            {
                staRTSLogger.Error("SpawnProjectile: specialAttack is null");
                this.SendSpecialAttackFired(null);
                return;
            }
            if (specialAttack.GetGunLocator() == null)
            {
                staRTSLogger.Error("SpawnProjectile: specialAttack.GetGunLocator() is null " + specialAttack.VO.Uid);
                this.SendSpecialAttackFired(specialAttack.VO);
                return;
            }
            if (specialAttack.GetGunLocator().transform == null)
            {
                staRTSLogger.Error("SpawnProjectile: specialAttack.GetGunLocator().transform is null " + specialAttack.VO.Uid);
                this.SendSpecialAttackFired(specialAttack.VO);
                return;
            }
            Vector3 position = specialAttack.GetGunLocator().transform.position;

            if (specialAttack.VO == null)
            {
                staRTSLogger.Error("SpawnProjectile: specialAttack.VO is null");
                this.SendSpecialAttackFired(specialAttack.VO);
                return;
            }
            float num      = specialAttack.VO.NumberOfAttackers;
            int   quantity = (int)((float)specialAttack.VO.Damage / num);

            specialAttack.ApplySpecialAttackBuffs(ref quantity);
            HealthFragment       payload = new HealthFragment(null, HealthType.Damaging, quantity);
            ProjectileController projectileController = Service.Get <ProjectileController>();

            if (specialAttack.TargetShield != null && !specialAttack.VO.ProjectileType.PassThroughShield)
            {
                Entity shieldBorderEntity = specialAttack.TargetShield.ShieldBorderEntity;
                if (shieldBorderEntity == null)
                {
                    staRTSLogger.Error("SpawnProjectile: shieldTarget is null");
                    this.SendSpecialAttackFired(specialAttack.VO);
                    return;
                }
                Vector3 targetWorldPos = specialAttack.TargetWorldPos;
                Vector3 targetWorldLoc = Vector3.zero;
                if (!Service.Get <ShieldController>().GetRayShieldIntersection(position, specialAttack.TargetWorldPos, specialAttack.TargetShield, out targetWorldLoc))
                {
                    targetWorldLoc = targetWorldPos;
                }
                Target target      = Target.CreateTargetWithWorldLocation((SmartEntity)shieldBorderEntity, targetWorldLoc);
                int    spawnBoardX = Units.WorldToBoardX((float)((int)position.x));
                int    spawnBoardZ = Units.WorldToBoardZ((float)((int)position.z));
                projectileController.SpawnProjectileForTarget(specialAttack.VO.HitDelay, spawnBoardX, spawnBoardZ, position, target, payload, specialAttack.TeamType, null, specialAttack.VO.ProjectileType, false, specialAttack.SpecialAttackBuffs, specialAttack.VO.Faction, null);
                this.AddProjectileInFlight(specialAttack.VO.ProjectileType);
            }
            else
            {
                Bullet bullet = projectileController.SpawnProjectileForTargetPosition(specialAttack.VO.HitDelay, position, specialAttack.TargetBoardX, specialAttack.TargetBoardZ, payload, specialAttack.TeamType, null, specialAttack.VO.ProjectileType, specialAttack.SpecialAttackBuffs, specialAttack.VO.Faction, specialAttack.VO.HasDropoff);
                if (specialAttack.VO.HasDropoff)
                {
                    bullet.Cookie = specialAttack;
                    ProjectileView projectileView = Service.Get <ProjectileViewManager>().SpawnProjectile(bullet);
                    Transform      transform      = projectileView.GetTransform();
                    this.AttachGameObject(transform, specialAttack.StarshipDetachableGameObject, false);
                    specialAttack.UpdateDetachableShadowAnimator(SpecialAttackDetachableObjectState.Falling);
                }
                this.AddProjectileInFlight(specialAttack.VO.ProjectileType);
            }
            this.SendSpecialAttackFired(specialAttack.VO);
        }
예제 #6
0
        public GenericUpgradeCatalog()
        {
            this.InitService();
            IDataController dataController = Service.Get <IDataController>();

            this.upgradeGroups       = new Dictionary <string, List <T> >();
            this.maxLevels           = new Dictionary <string, T>();
            this.maxLevelsForRewards = new Dictionary <string, T>();
            foreach (T current in dataController.GetAll <T>())
            {
                List <T> list;
                if (this.upgradeGroups.ContainsKey(current.UpgradeGroup))
                {
                    list = this.upgradeGroups[current.UpgradeGroup];
                }
                else
                {
                    list = new List <T>();
                    this.upgradeGroups.Add(current.UpgradeGroup, list);
                }
                if (this.maxLevels.ContainsKey(current.UpgradeGroup))
                {
                    T t = this.maxLevels[current.UpgradeGroup];
                    if (current.Lvl > t.Lvl && current.PlayerFacing)
                    {
                        this.maxLevels[current.UpgradeGroup] = current;
                    }
                }
                else
                {
                    this.maxLevels[current.UpgradeGroup] = current;
                }
                if (this.maxLevelsForRewards.ContainsKey(current.UpgradeGroup))
                {
                    T t2 = this.maxLevelsForRewards[current.UpgradeGroup];
                    if (current.Lvl > t2.Lvl)
                    {
                        this.maxLevelsForRewards[current.UpgradeGroup] = current;
                    }
                }
                else
                {
                    this.maxLevelsForRewards[current.UpgradeGroup] = current;
                }
                list.Add(current);
            }
            foreach (KeyValuePair <string, List <T> > current2 in this.upgradeGroups)
            {
                current2.get_Value().Sort(new Comparison <T>(GenericUpgradeCatalog <T> .SortByLevelAscending));
                int arg_23A_0 = current2.get_Value().Count;
                T   t3        = this.maxLevels[current2.get_Key()];
                if (arg_23A_0 != t3.Lvl)
                {
                    for (int i = 1; i < current2.get_Value().Count; i++)
                    {
                        t3 = current2.get_Value()[i];
                        int arg_283_0 = t3.Lvl;
                        t3 = current2.get_Value()[i - 1];
                        if (arg_283_0 == t3.Lvl)
                        {
                            StaRTSLogger arg_330_0 = Service.Get <StaRTSLogger>();
                            string       arg_330_1 = "Duplicate levels in group {4}: {0} ({1}) AND {2} ({3})";
                            object[]     expr_298  = new object[5];
                            int          arg_2B7_1 = 0;
                            t3 = current2.get_Value()[i];
                            expr_298[arg_2B7_1] = t3.Uid;
                            int arg_2DC_1 = 1;
                            t3 = current2.get_Value()[i];
                            expr_298[arg_2DC_1] = t3.Lvl;
                            int arg_2FE_1 = 2;
                            t3 = current2.get_Value()[i - 1];
                            expr_298[arg_2FE_1] = t3.Uid;
                            int arg_325_1 = 3;
                            t3 = current2.get_Value()[i - 1];
                            expr_298[arg_325_1] = t3.Lvl;
                            expr_298[4]         = current2.get_Key();
                            arg_330_0.ErrorFormat(arg_330_1, expr_298);
                        }
                        else
                        {
                            t3 = current2.get_Value()[i];
                            int arg_378_0 = t3.Lvl;
                            t3 = current2.get_Value()[i - 1];
                            if (arg_378_0 != t3.Lvl + 1)
                            {
                                StaRTSLogger arg_425_0 = Service.Get <StaRTSLogger>();
                                string       arg_425_1 = "In Group {4} expected {0} ({1}) to be one level higher than {2} ({3})";
                                object[]     expr_38D  = new object[5];
                                int          arg_3AC_1 = 0;
                                t3 = current2.get_Value()[i];
                                expr_38D[arg_3AC_1] = t3.Uid;
                                int arg_3D1_1 = 1;
                                t3 = current2.get_Value()[i];
                                expr_38D[arg_3D1_1] = t3.Lvl;
                                int arg_3F3_1 = 2;
                                t3 = current2.get_Value()[i - 1];
                                expr_38D[arg_3F3_1] = t3.Uid;
                                int arg_41A_1 = 3;
                                t3 = current2.get_Value()[i - 1];
                                expr_38D[arg_41A_1] = t3.Lvl;
                                expr_38D[4]         = current2.get_Key();
                                arg_425_0.ErrorFormat(arg_425_1, expr_38D);
                            }
                        }
                    }
                }
            }
        }
예제 #7
0
 public VersionedFileManifest()
 {
     this.translatedUrls = new Dictionary <string, string>();
     this.logger         = Service.Get <StaRTSLogger>();
 }
 public VersionedFileManifestLoader(MonoBehaviour engine)
 {
     this.engine = engine;
     this.logger = Service.Get <StaRTSLogger>();
 }