protected override void OnPrepare(GameState prev, object[] stateParams) { if (this.App.GameDatabase == null) { this.App.NewGame(new Random(12345)); if (stateParams == null || stateParams.Length == 0) { int orbitalObjectID = this.App.GameDatabase.GetPlayerInfo(this.App.LocalPlayer.ID).Homeworld.Value; stateParams = new object[2] { (object)this.App.GameDatabase.GetOrbitalObjectInfo(orbitalObjectID).StarSystemID, (object)orbitalObjectID }; } } int stateParam1 = (int)stateParams[0]; int stateParam2 = (int)stateParams[1]; this._crits = new GameObjectSet(this.App); this._sky = new Sky(this.App, SkyUsage.InSystem, stateParam1); this._crits.Add((IGameObject)this._sky); this._camera = this._crits.Add <OrbitCameraController>(); this._planetView = this._crits.Add <PlanetView>(); this._starsystem = new StarSystem(this.App, 1f, stateParam1, Vector3.Zero, true, (CombatSensor)null, false, 0, this is DefenseManagerState, true); this._crits.Add((IGameObject)this._starsystem); this._starsystem.PostSetProp("CameraController", (IGameObject)this._camera); this._starsystem.PostSetProp("InputEnabled", true); this.CurrentSystem = stateParam1; this.SelectedObject = stateParam2; }
public override void Initialize() { this._app.UI.SetEnabled(this._app.UI.Path(this.ID, ReactionDialog.UIConfirmButton), false); AdmiralInfo admiralInfo = this._app.GameDatabase.GetAdmiralInfo(this._currentReaction.fleet.AdmiralID); if (admiralInfo != null) { this._app.UI.SetText(this._app.UI.Path(this.ID, ReactionDialog.UIAdmiralLabel), admiralInfo.Name); } this._sky = new Sky(this._app, SkyUsage.StarMap, 0); this._crits = new GameObjectSet(this._app); this._crits.Add((IGameObject)this._sky); this._cameraReduced = new OrbitCameraController(this._app); this._cameraReduced.MinDistance = 2.5f; this._cameraReduced.MaxDistance = 100f; this._cameraReduced.DesiredDistance = 50f; this._cameraReduced.DesiredYaw = MathHelper.DegreesToRadians(45f); this._cameraReduced.DesiredPitch = -MathHelper.DegreesToRadians(25f); this._cameraReduced.SnapToDesiredPosition(); this._starmapReduced = new StarMap(this._app, this._app.Game, this._sky); this._starmapReduced.Initialize(this._crits); this._starmapReduced.SetCamera(this._cameraReduced); this._starmapReduced.FocusEnabled = false; this._starmapReduced.SetFocus((IGameObject)this._starmapReduced.Systems.Reverse[this._currentReaction.fleet.SystemID]); this._starmapReduced.Select((IGameObject)this._starmapReduced.Systems.Reverse[this._currentReaction.fleet.SystemID]); this._starmapReduced.SelectEnabled = false; this._starmapReduced.PostSetProp("MissionTarget", (object)this._starmapReduced.Systems.Reverse[this._currentReaction.fleet.SystemID].ObjectID, (object)true); this._starmapReduced.PostSetProp("CullCenter", this._app.GameDatabase.GetStarSystemInfo(this._currentReaction.fleet.SystemID).Origin); this._starmapReduced.PostSetProp("CullRadius", 15f); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarMapViewport"), (object)this._starmapReduced.ObjectID); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarMapViewport"), true); this._app.PostRequestSpeech(string.Format("STRAT_014-01_{0}_{1}AdmiralGetsReactionPhase", (object)this._app.GameDatabase.GetFactionName(this._app.GameDatabase.GetPlayerFactionID(this._app.LocalPlayer.ID)), (object)admiralInfo.GetAdmiralSoundCueContext(this._app.AssetDatabase)), 50, 120, 0.0f); this._crits.Activate(); }
protected override void OnExit(GameState prev, ExitReason reason) { this.App.HotKeyManager.RemoveListener((IKeyBindListener)this); if (this._manager != null) { this._manager.Dispose(); this._manager = (FleetManager)null; } if (this._fleetWidget != null) { this._fleetWidget.OnFleetsModified -= new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); this._fleetWidget.Dispose(); this._fleetWidget = (FleetWidget)null; } foreach (ShipDummy shipDummy in this._shipDummies) { shipDummy.Dispose(); } this._shipDummies = (List <ShipDummy>)null; if (this._camera != null) { this._camera.Dispose(); this._camera = (OrbitCameraController)null; } if (this._crits != null) { this._crits.Dispose(); this._crits = (GameObjectSet)null; } this.App.UI.DestroyPanel(this._contextMenuID); this.App.UI.DestroyPanel(this._shipContextMenuID); this.App.UI.GameEvent -= new UIEventGameEvent(this.UICommChannel_GameEvent); }
protected override void OnEnter() { this._finalSync = false; this.App.UI.SetScreen("FleetManager"); this.App.UI.UnlockUI(); this.App.UI.GameEvent += new UIEventGameEvent(this.UICommChannel_GameEvent); this._sky.Active = true; this._camera = new OrbitCameraController(this.App); this._camera.DesiredPitch = MathHelper.DegreesToRadians(-75f); this._camera.TargetPosition = new Vector3(0.0f, 0.0f, 0.0f); this._camera.MaxDistance = 6000f; this._camera.DesiredDistance = this._camera.MaxDistance; this.App.UI.ClearItems("partFleetShips"); this._manager.PostSetProp("CameraController", (IGameObject)this._camera); this._manager.PostSetProp("InputEnabled", true); this._manager.PostSetProp("SyncShipList", "partFleetShips"); this._manager.PostSetProp("SyncCommandPointDisplay", "cmdpointsValue"); this._manager.Active = true; this.App.GameDatabase.GetPlayerHomeworld(this.App.LocalPlayer.ID); IEnumerable <FleetInfo> fleetInfoBySystemId = this.App.GameDatabase.GetFleetInfoBySystemID(this._targetSystemID, FleetType.FL_ALL); this.SyncShipContextMenu(fleetInfoBySystemId); EmpireBarUI.SyncTitleFrame(this.App); this._fleetWidget.SetSyncedFleets(fleetInfoBySystemId.Where <FleetInfo>((Func <FleetInfo, bool>)(x => { if (x.PlayerID == this.App.LocalPlayer.ID) { return(!Kerberos.Sots.StarFleet.StarFleet.IsGardenerFleet(this.App.Game, x)); } return(false); })).ToList <FleetInfo>()); this._manager.PostSetProp("FleetWidget", this._fleetWidget.ObjectID); this._fleetWidget.ShipSelectionEnabled = true; if (this.App.LocalPlayer.Faction.Name == "loa") { this.App.UI.SetEnabled("fleetmanagerloaCompose", true); this.App.UI.SetVisible("fleetmanagerloaCompose", true); this.App.UI.SetVisible("ngpWarning", true); } else { this.App.UI.SetEnabled("fleetmanagerloaCompose", false); this.App.UI.SetVisible("fleetmanagerloaCompose", false); this.App.UI.SetVisible("ngpWarning", false); } this.App.UI.AutoSize("buttonPanel"); this.App.UI.ForceLayout("buttonPanel"); this.App.UI.AutoSize("fleetDetailsWidget"); this.App.UI.ForceLayout("fleetDetailsWidget"); this.App.UI.AutoSize("leftPanel"); this.App.UI.ForceLayout("leftPanel"); this.App.UI.AutoSize("buttonPanel"); this.App.UI.ForceLayout("buttonPanel"); this.App.UI.AutoSize("fleetDetailsWidget"); this.App.UI.ForceLayout("fleetDetailsWidget"); this.App.UI.AutoSize("leftPanel"); this.App.UI.ForceLayout("leftPanel"); this.App.HotKeyManager.AddListener((IKeyBindListener)this); }
protected override void OnPrepare(GameState prev, object[] parms) { this._rnd = new Random(); this._crits = new GameObjectSet(this.App); this._sky = new Sky(this.App, SkyUsage.InSystem, 0); this._crits.Add((IGameObject)this._sky); this._camera = this._crits.Add <OrbitCameraController>(); this._input = this._crits.Add <CombatInput>(); this._grid = this._crits.Add <CombatGrid>(); }
protected override void OnPrepare(GameState prev, object[] parms) { this._crits = new GameObjectSet(this.App); this._sky = new Sky(this.App, SkyUsage.InSystem, 0); this._crits.Add((IGameObject)this._sky); this._camera = this._crits.Add <OrbitCameraController>(); this._types = this.App.AssetDatabase.PlanetGenerationRules.GetStellarBodyTypes(); this._factions = this.App.AssetDatabase.PlanetGenerationRules.GetFactions(); this.App.UI.LoadScreen("TestPlanet"); }
public void Initialize() { this._builder = new ShipBuilder(this.App); this._crits = new GameObjectSet(this.App); this._camera = new OrbitCameraController(this.App); this._camera.DesiredDistance = 10000f; this._crits.Add((IGameObject)this._camera); this._shipHoloView = new ShipHoloView(this.App, this._camera); this._shipID = 0; }
public static Combat Create( App game, OrbitCameraController cameraController, CombatInput input, CombatSensor sensor, StarSystem system, CombatGrid grid, Vector3 origin, float radius, int duration, Player[] players, Dictionary <Player, Dictionary <Player, PlayerCombatDiplomacy> > diplomacyStates, bool simulateOnly = false) { List <int> list = ((IEnumerable <Player>)players).Where <Player>((Func <Player, bool>)(x => !x.IsStandardPlayer)).Select <Player, int>((Func <Player, int>)(x => x.ObjectID)).ToList <int>(); Combat combat = new Combat(); List <object> objectList = new List <object>(); objectList.Add((object)cameraController.GetObjectID()); objectList.Add((object)input.GetObjectID()); objectList.Add((object)sensor.GetObjectID()); objectList.Add((object)system.GetObjectID()); objectList.Add((object)grid.GetObjectID()); objectList.Add((object)origin); objectList.Add((object)radius); objectList.Add((object)duration); objectList.Add((object)game.LocalPlayer.GetObjectID()); objectList.Add((object)simulateOnly); objectList.Add((object)players.Length); foreach (Player player in players) { objectList.Add((object)player.ObjectID); } objectList.Add((object)diplomacyStates.Count); foreach (KeyValuePair <Player, Dictionary <Player, PlayerCombatDiplomacy> > diplomacyState in diplomacyStates) { objectList.Add((object)diplomacyState.Key.GetObjectID()); objectList.Add((object)diplomacyState.Value.Count); foreach (KeyValuePair <Player, PlayerCombatDiplomacy> keyValuePair in diplomacyState.Value) { objectList.Add((object)keyValuePair.Key.GetObjectID()); objectList.Add((object)keyValuePair.Value); } } objectList.Add((object)list.Count); foreach (int num in list) { objectList.Add((object)num); } game.AddExistingObject((IGameObject)combat, objectList.ToArray()); return(combat); }
public override string[] CloseDialog() { if (this._crits != null) this._crits.Dispose(); this._crits = (GameObjectSet)null; this._starsystem = (Kerberos.Sots.GameStates.StarSystem)null; this._camera = (OrbitCameraController)null; this._sky = (Sky)null; foreach (PlanetWidget planetWidget in this._planetWidgets) planetWidget.Terminate(); foreach (SystemWidget systemWidget in this._systemWidgets) systemWidget.Terminate(); this._systemWidget.Terminate(); return (string[])null; }
protected override void OnExit(GameState next, ExitReason reason) { this.App.HotKeyManager.RemoveListener((IKeyBindListener)this); this._manager.Dispose(); this._fleetWidget.Dispose(); if (this._camera != null) { this._camera.Dispose(); this._camera = (OrbitCameraController)null; } if (this._crits == null) { return; } this._crits.Dispose(); this._crits = (GameObjectSet)null; }
public override void Initialize() { this._systemWidget = new SystemWidget(this.App, this.App.UI.Path(this.ID, "starDetailsCard")); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID); this._app.UI.SetText(this._app.UI.Path(this.ID, "intel_desc"), this._descriptor); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerAvatar"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.AvatarAssetPath)); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerBadge"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.BadgeAssetPath)); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarSystemViewport"), false); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP")); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 1, "System"); this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0); this._crits = new GameObjectSet(this._app); this._camera = new OrbitCameraController(this._app); this._sky = new Sky(this._app, SkyUsage.InSystem, this._systemID); this._starsystem = new Kerberos.Sots.GameStates.StarSystem(this.App, 1f, this._systemID, Vector3.Zero, true, (CombatSensor)null, false, 0, false, true); this._starsystem.SetAutoDrawEnabled(false); this._starsystem.SetCamera(this._camera); this._starsystem.SetInputEnabled(true); this._starsystem.PostObjectAddObjects((IGameObject)this._sky); foreach (IGameObject state in this._starsystem.Crits.Objects.Where<IGameObject>((Func<IGameObject, bool>)(x => { if (!(x is StellarBody)) return x is StarModel; return true; }))) state.PostSetProp("AutoDrawEnabled", false); this._crits.Add((IEnumerable<IGameObject>)new IGameObject[3] { (IGameObject) this._camera, (IGameObject) this._sky, (IGameObject) this._starsystem }); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarSystemViewport"), (object)this._starsystem.ObjectID); this._critsInitialized = false; this._camera.PostSetLook(new Vector3(0.0f, 0.0f, 0.0f)); this._camera.PostSetPosition(new Vector3(0.0f, 100000f, 0.0f)); this._camera.MaxDistance = 500000f; this._camera.MinDistance = 100000f; StarSystemUI.SyncSystemDetailsWidget(this._app, this._app.UI.Path(this.ID, "system_details"), this._systemID, false, true); StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true); this._currentFilterMode = DialogSystemIntel.PlanetFilterMode.AllPlanets; this._planetWidgets = new List<PlanetWidget>(); this.SetSyncedSystem(starSystemInfo); this._systemWidget.Sync(this._systemID); }
public override void Initialize() { this._sky = new Sky(this._app, SkyUsage.StarMap, 0); this._crits = new GameObjectSet(this._app); this._planetView = this._crits.Add <PlanetView>(); this._crits.Add((IGameObject)this._sky); OrbitalObjectInfo orbitalObjectInfo = this._app.GameDatabase.GetOrbitalObjectInfo(this._planetID); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo.StarSystemID); this._app.UI.SetText("gameColonyName", orbitalObjectInfo.Name); this._enteredColonyName = orbitalObjectInfo.Name; this._app.UI.SetVisible(this._app.UI.Path(this.ID, "btnAbandon"), false); this._app.UI.SetText(this._app.UI.Path("colonyCreateTitle"), (this._homeworld ? App.Localize("@UI_STARMAP_HOMEWORLD_ESTABLISHED") : App.Localize("@UI_STARMAP_COLONY_ESTABLISHED")) + " - " + starSystemInfo.Name); this._cameraReduced = new OrbitCameraController(this._app); this._cameraReduced.MinDistance = 2.5f; this._cameraReduced.MaxDistance = 100f; this._cameraReduced.DesiredDistance = 50f; this._cameraReduced.DesiredYaw = MathHelper.DegreesToRadians(45f); this._cameraReduced.DesiredPitch = -MathHelper.DegreesToRadians(25f); this._cameraReduced.SnapToDesiredPosition(); this._starmapReduced = new StarMap(this._app, this._app.Game, this._sky); this._starmapReduced.Initialize(this._crits); this._starmapReduced.SetCamera(this._cameraReduced); this._starmapReduced.FocusEnabled = false; this._starmapReduced.SetFocus((IGameObject)this._starmapReduced.Systems.Reverse[starSystemInfo.ID]); this._starmapReduced.Select((IGameObject)this._starmapReduced.Systems.Reverse[starSystemInfo.ID]); this._starmapReduced.SelectEnabled = false; this._starmapReduced.PostSetProp("MissionTarget", (object)this._starmapReduced.Systems.Reverse[starSystemInfo.ID].ObjectID, (object)true); this._starmapReduced.PostSetProp("CullCenter", this._app.GameDatabase.GetStarSystemInfo(starSystemInfo.ID).Origin); this._starmapReduced.PostSetProp("CullRadius", 15f); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarMapViewport"), (object)this._starmapReduced.ObjectID); this.CachePlanet(this._app.GameDatabase.GetPlanetInfo(this._planetID)); this._planetView.PostSetProp("Planet", this._cachedPlanet != null ? this._cachedPlanet.ObjectID : 0); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "system_details.Planet_panel"), (object)this._planetView.ObjectID); StarSystemMapUI.Sync(this._app, orbitalObjectInfo.StarSystemID, this._app.UI.Path(this.ID, "system_map"), true); StarSystemUI.SyncSystemDetailsWidget(this._app, "colony_event_dialog.system_details", orbitalObjectInfo.StarSystemID, true, true); StarSystemUI.SyncPlanetDetailsControl(this._app.Game, this._app.UI.Path(this.ID, "system_details"), this._planetID); StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), orbitalObjectInfo.ID, ""); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarMapViewport"), false); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP")); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 1, App.Localize("@SYSTEMDETAILS_STAR_MAP")); this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0); this._crits.Activate(); }
public override void Initialize() { this._sky = new Sky(this._app, SkyUsage.StarMap, 0); this._crits = new GameObjectSet(this._app); this._planetView = this._crits.Add <PlanetView>(); this._crits.Add((IGameObject)this._sky); StationInfo stationInfo = this._app.GameDatabase.GetStationInfo(this._stationID); OrbitalObjectInfo orbitalObjectInfo1 = this._app.GameDatabase.GetOrbitalObjectInfo(this._stationID); OrbitalObjectInfo orbitalObjectInfo2 = this._app.GameDatabase.GetOrbitalObjectInfo(orbitalObjectInfo1.ParentID.Value); this._app.UI.SetText(this._app.UI.Path(this.ID, "station_class"), string.Format(App.Localize("@STATION_LEVEL"), (object)stationInfo.DesignInfo.StationLevel.ToString(), (object)stationInfo.DesignInfo.StationType.ToString())); this._app.UI.SetText(this._app.UI.Path(this.ID, "upkeep_cost"), string.Format(App.Localize("@STATION_UPKEEP_COST"), (object)GameSession.CalculateStationUpkeepCost(this._app.GameDatabase, this._app.AssetDatabase, stationInfo).ToString())); if (stationInfo.DesignInfo.StationType == StationType.NAVAL) { this._app.UI.SetText(this._app.UI.Path(this.ID, "naval_capacity"), string.Format(App.Localize("@STATION_FLEET_CAPACITY"), (object)this._app.GameDatabase.GetSystemSupportedCruiserEquivalent(this._app.Game, orbitalObjectInfo2.StarSystemID, this._app.LocalPlayer.ID).ToString())); } else { this._app.UI.SetVisible(this._app.UI.Path(this.ID, "naval_capacity"), false); } StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo2.StarSystemID); this._app.UI.SetText("gameStationName", orbitalObjectInfo1.Name); this._enteredStationName = orbitalObjectInfo2.Name; this._app.UI.SetText(this._app.UI.Path(this.ID, "system_name"), string.Format(App.Localize("@STATION_BUILT"), (object)starSystemInfo.Name).ToUpperInvariant()); this._cameraReduced = new OrbitCameraController(this._app); this._cameraReduced.MinDistance = 1002.5f; this._cameraReduced.MaxDistance = 10000f; this._cameraReduced.DesiredDistance = 2000f; this._cameraReduced.DesiredYaw = MathHelper.DegreesToRadians(45f); this._cameraReduced.DesiredPitch = -MathHelper.DegreesToRadians(25f); this._cameraReduced.SnapToDesiredPosition(); this._starmapReduced = new StarMap(this._app, this._app.Game, this._sky); this._starmapReduced.Initialize(this._crits); this._starmapReduced.SetCamera(this._cameraReduced); this._starmapReduced.FocusEnabled = false; this._starmapReduced.PostSetProp("Selected", this._starmapReduced.Systems.Reverse[starSystemInfo.ID].ObjectID); this._starmapReduced.PostSetProp("CullCenter", this._app.GameDatabase.GetStarSystemInfo(starSystemInfo.ID).Origin); this._starmapReduced.PostSetProp("CullRadius", 15f); DesignInfo di = DesignLab.CreateStationDesignInfo(this._app.AssetDatabase, this._app.GameDatabase, this._app.LocalPlayer.ID, stationInfo.DesignInfo.StationType, stationInfo.DesignInfo.StationLevel, false); this._stationModel = new StarSystemDummyOccupant(this._app, this._app.AssetDatabase.ShipSections.First <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x => x.FileName == di.DesignSections[0].FilePath)).ModelName, stationInfo.DesignInfo.StationType); this._stationModel.PostSetScale(1f / 500f); this._stationModel.PostSetPosition(this._trans); }
void Start() { characterInstance = GameObject.Instantiate(characterPrefab); var bridge = characterInstance.gameObject.AddComponent <PlayerInputBridge>(); // dummyCharacter = GameObject.Instantiate(characterPrefab); // Destroy(dummyCharacter.GetComponent<Collider>()); // dummyCharacter.gameObject.SetActive(false); bridge.playerId = playerId; bridge.controlledObject = characterInstance.gameObject; waterInstance = GameObject.Instantiate(waterPrefab); followCamera = GameObject.Instantiate(cameraPrefab); FollowTransform(characterInstance.mainShells.transform); }
public StarMapPreview(App app, GameSetup setup) { this.crits = new GameObjectSet(app); GameDatabase.New(setup.StarMapFile, app.AssetDatabase, true); this.sim = App.NewGame(app, new Random(), setup, app.AssetDatabase, setup, GameSession.Flags.NoNewGameMessage | GameSession.Flags.NoTechTree | GameSession.Flags.NoScriptModules | GameSession.Flags.NoDefaultFleets | GameSession.Flags.NoOrbitalObjects | GameSession.Flags.NoGameSetup); this.sky = new Sky(app, SkyUsage.StarMap, new Random().Next()); this.crits.Add((IGameObject)this.sky); this.camera = new OrbitCameraController(app); this.camera.MinDistance = 10f; this.camera.MaxDistance = 100f; this.camera.DesiredDistance = 70f; this.camera.DesiredYaw = MathHelper.DegreesToRadians(45f); this.camera.DesiredPitch = MathHelper.DegreesToRadians(-45f); this.starmap = new StarMap(app, this.sim, (Sky)null); this.starmap.SelectEnabled = false; this.starmap.SetCamera(this.camera); this.starmap.Initialize(this.crits); this.starmap.ViewFilter = StarMapViewFilter.VF_TERRAIN; this.crits.Add((IGameObject)this.starmap); }
public void Dispose() { this.starmap.Dispose(); if (this.crits != null) { this.crits.Dispose(); this.crits = (GameObjectSet)null; } if (this.camera != null) { this.camera.Dispose(); this.camera = (OrbitCameraController)null; } if (this.sim == null) { return; } this.sim.Dispose(); this.sim = (GameSession)null; }
protected override void OnEnter() { this.App.UI.SetScreen("RiderManager"); this._manager = new RiderManager(this.App, "RiderManager"); this._camera = new OrbitCameraController(this.App); this._camera.DesiredPitch = MathHelper.DegreesToRadians(0.0f); this._camera.TargetPosition = new Vector3(0.0f, 0.0f, 0.0f); this._camera.MaxDistance = 6000f; this._camera.DesiredDistance = this._camera.MaxDistance; this._manager.PostSetProp("CameraController", (IGameObject)this._camera); this._manager.PostSetActive(true); IEnumerable <FleetInfo> byPlayerAndSystem = this.App.GameDatabase.GetFleetsByPlayerAndSystem(this.App.LocalPlayer.ID, this._targetSystemID, FleetType.FL_ALL); this._manager.SetSyncedFleets(byPlayerAndSystem.ToList <FleetInfo>()); this.SyncFleetShipModels(); this._fleetWidget.ShipFilter += new FleetWidget.FleetWidgetShipFilter(this.FleetWidgetShipFilter); this._fleetWidget.ShowEmptyFleets = false; this._fleetWidget.SetSyncedFleets(byPlayerAndSystem.ToList <FleetInfo>()); this._manager.PostSetProp("SetFleetWidget", (IGameObject)this._fleetWidget); this.App.HotKeyManager.AddListener((IKeyBindListener)this); }
protected override void OnPrepare(GameState prev, object[] parms) { this._crits = new GameObjectSet(this.App); this._crits.Add((IGameObject) new Sky(this.App, SkyUsage.InSystem, 0)); this._camera = this._crits.Add <OrbitCameraController>(); this._camera.DesiredDistance = 30f; this._combatGrid = this._crits.Add <CombatGrid>(); this._combatGrid.GridSize = 5000f; this._combatGrid.CellSize = 500f; this._combatInput = this._crits.Add <CombatInput>(); this._combatInput.CameraID = this._camera.ObjectID; this._combatInput.CombatGridID = this._combatGrid.ObjectID; this._bigbad = this._crits.Add <StaticModel>((object)"\\base\\factions\\zuul\\models\\Suul'ka\\suulka_test.scene"); this._litmus1 = this._crits.Add <StaticModel>((object)"\\base\\props\\litmus_01.scene"); this._litmus2 = this._crits.Add <StaticModel>((object)"\\base\\props\\litmus_02.scene"); this._litmus3 = this._crits.Add <StaticModel>((object)"\\base\\props\\litmus_03.scene"); this._bigbad.Position = new Vector3(0.0f, -800f, 0.0f); this._litmus1.Position = new Vector3(-300f, 0.0f, 0.0f); this._litmus2.Position = new Vector3(0.0f, 0.0f, 0.0f); this._litmus3.Position = new Vector3(300f, 0.0f, 0.0f); }
protected override void OnPrepare(GameState prev, object[] parms) { this.App.NewGame(); this._crits = new GameObjectSet(this.App); this._sky = new Sky(this.App, SkyUsage.InSystem, 0); this._camera = this._crits.Add <OrbitCameraController>(); this._camera.TargetPosition = new Vector3(0.0f, 0.0f, 0.0f); this._combatInput = this._crits.Add <CombatInput>(); this._combatGrid = this._crits.Add <CombatGrid>(); CreateShipParams createShipParams = new CreateShipParams(); createShipParams.player = this.App.LocalPlayer; createShipParams.sections = this.App.AssetDatabase.ShipSections.Where <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x => { if (!(x.Faction == "morrigi") || x.Class != ShipClass.Cruiser) { return(false); } if (!x.FileName.Contains("cr_cmd.section") && !x.FileName.Contains("cr_eng_fusion.section")) { return(x.FileName.Contains("cr_mis_armor.section")); } return(true); })); createShipParams.turretHousings = this.App.AssetDatabase.TurretHousings; createShipParams.weapons = this.App.AssetDatabase.Weapons; createShipParams.preferredWeapons = this.App.AssetDatabase.Weapons; createShipParams.modules = this.App.AssetDatabase.Modules; createShipParams.preferredModules = this.App.AssetDatabase.Modules; createShipParams.psionics = this.App.AssetDatabase.Psionics; createShipParams.faction = this.App.AssetDatabase.GetFaction("morrigi"); createShipParams.shipName = "BOOGER"; createShipParams.inputID = this._combatInput.ObjectID; this._ship = Ship.CreateShip(this.App, createShipParams); this._crits.Add((IGameObject)this._ship); this._ship2 = Ship.CreateShip(this.App, createShipParams); this._ship2.Position = new Vector3(1000f, 0.0f, 0.0f); this._crits.Add((IGameObject)this._ship2); }
public ShipHoloView(App game, OrbitCameraController cameraController) { game.AddExistingObject((IGameObject)this, (object)cameraController.GetObjectID()); }
public void Enter(App app) { this._app = app; if (this._app.GameDatabase == null) { this._app.NewGame(); } app.Game.SetLocalPlayer(app.GetPlayer(1)); this._set = new GameObjectSet(app); this._postLoadedObjects = new List <IGameObject>(); this._set.Add((IGameObject) new Sky(app, SkyUsage.InSystem, new Random().Next())); if (ScriptHost.AllowConsole) { this._input = this._set.Add <CombatInput>(); } this._camera = this._set.Add <OrbitCameraController>(); this._camera.SetAttractMode(true); this._camera.TargetPosition = new Vector3(500000f, 0.0f, 0.0f); this._camera.MinDistance = 1f; this._camera.MaxDistance = 11000f; this._camera.DesiredDistance = 11000f; this._camera.DesiredPitch = MathHelper.DegreesToRadians(-2f); this._camera.DesiredYaw = MathHelper.DegreesToRadians(45f); int systemId = 0; IEnumerable <HomeworldInfo> homeworlds = this._app.GameDatabase.GetHomeworlds(); HomeworldInfo homeworldInfo = homeworlds.FirstOrDefault <HomeworldInfo>((Func <HomeworldInfo, bool>)(x => x.PlayerID == app.LocalPlayer.ID)); if (homeworldInfo != null) { systemId = homeworldInfo.SystemID; } else if (homeworlds.Count <HomeworldInfo>() > 0) { systemId = homeworlds.ElementAt <HomeworldInfo>(new Random().NextInclusive(0, homeworlds.Count <HomeworldInfo>() - 1)).SystemID; } this._starsystem = new StarSystem(this._app, 1f, systemId, new Vector3(0.0f, 0.0f, 0.0f), false, (CombatSensor)null, true, 0, false, true); this._set.Add((IGameObject)this._starsystem); this._starsystem.PostSetProp("InputEnabled", false); this._starsystem.PostSetProp("RenderSuroundingItems", false); Vector3 vector1 = new Vector3(); float num1 = 10000f; IEnumerable <PlanetInfo> infosOrbitingStar = this._app.GameDatabase.GetPlanetInfosOrbitingStar(systemId); bool flag1 = false; foreach (PlanetInfo planetInfo in infosOrbitingStar) { if (planetInfo != null) { ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(planetInfo.ID); if (colonyInfoForPlanet != null && colonyInfoForPlanet.PlayerID == this._app.LocalPlayer.ID) { vector1 = this._app.GameDatabase.GetOrbitalTransform(planetInfo.ID).Position; num1 = StarSystemVars.Instance.SizeToRadius(planetInfo.Size); flag1 = true; break; } } } if (!flag1) { PlanetInfo[] array = infosOrbitingStar.ToArray <PlanetInfo>(); if (array.Length > 0) { PlanetInfo planetInfo = array[new Random().Next(array.Length)]; vector1 = this._app.GameDatabase.GetOrbitalTransform(planetInfo.ID).Position; num1 = StarSystemVars.Instance.SizeToRadius(planetInfo.Size); } } this._camera.DesiredYaw = -(float)Math.Atan2((double)vector1.Z, (double)vector1.X); this._camera.TargetPosition = vector1; Matrix rotationYpr = Matrix.CreateRotationYPR(this._camera.DesiredYaw, 0.0f, 0.0f); Vector3[] shuffledPlayerColors = Player.GetShuffledPlayerColors(this._rand); foreach (string index in this._players.Keys.ToList <string>()) { this._players[index] = new Player(app, app.Game, new PlayerInfo() { FactionID = app.GameDatabase.GetFactionIdFromName(index), AvatarAssetPath = string.Empty, BadgeAssetPath = app.AssetDatabase.GetRandomBadgeTexture(index, this._rand), PrimaryColor = shuffledPlayerColors[0], SecondaryColor = new Vector3(this._rand.NextSingle(), this._rand.NextSingle(), this._rand.NextSingle()) }, Player.ClientTypes.AI); this._set.Add((IGameObject)this._players[index]); } Vector3 zero = Vector3.Zero; double num2 = (double)Vector3.Cross(vector1, new Vector3(0.0f, 1f, 0.0f)).Normalize(); float num3 = 500f; int num4 = 4; float num5 = num3 * (float)num4; Vector3 vector3_1 = new Vector3(-num5, 0.0f, -num5); Vector3 vector3_2 = vector1 + -rotationYpr.Forward * (num1 + 2000f + num5); List <Vector3> vector3List1 = new List <Vector3>(); for (int index = 0; index < 81; ++index) { int num6 = index % 5; int num7 = index / 5; Vector3 vector3_3 = new Vector3(vector3_1.X + (float)num7 * num3, 0.0f, vector3_1.Z + (float)num6 * num3); vector3_3 += vector3_2; vector3List1.Add(vector3_3); } List <Vector3> vector3List2 = new List <Vector3>(); foreach (Vector3 pos in vector3List1) { if (this.PositionCollidesWithObject(pos, 400f)) { vector3List2.Add(pos); } } foreach (Vector3 vector3_3 in vector3List2) { vector3List1.Remove(vector3_3); } int num8 = this._rand.NextInclusive(6, 12); List <int> intList = new List <int>(); for (int index1 = 0; index1 < num8; ++index1) { int index2 = 0; bool flag2 = true; for (int index3 = 0; flag2 && index3 < vector3List1.Count; ++index3) { index2 = this._rand.NextInclusive(0, Math.Max(vector3List1.Count - 1, 0)); flag2 = intList.Contains(index2); if (intList.Count == vector3List1.Count) { break; } } Vector3 off = vector3List1.Count > 0 ? vector3List1[index2] : vector1; if (index1 < 3) { zero += this.CreateRandomShip(off, "loa", index1 == 0); } else { zero += this.CreateRandomShip(off, "", false); } if (!intList.Contains(index2)) { intList.Add(index2); } } if (num8 <= 0) { return; } Vector3 vector3_4 = zero / (float)num8; }
public void SetCamera(OrbitCameraController value) { this.PostSetProp("CameraController", (IGameObject)value); }