private static void CalculateEntityAreaData() { log.Info("Calculating area information for entities..."); var mapFiles = new Dictionary <ushort, MapFile>(); var entities = new HashSet <EntityModel>(); foreach (EntityModel model in WorldDatabase.GetEntitiesWithoutArea()) { entities.Add(model); if (!mapFiles.TryGetValue(model.World, out MapFile mapFile)) { WorldEntry entry = GameTableManager.World.GetEntry(model.World); mapFile = BaseMap.LoadMapFile(entry.AssetPath); mapFiles.Add(model.World, mapFile); } uint worldAreaId = mapFile.GetWorldAreaId(new Vector3(model.X, model.Y, model.Z)); model.Area = (ushort)worldAreaId; log.Info($"Calculated area {worldAreaId} for entity {model.Id}."); } WorldDatabase.UpdateEntities(entities); log.Info($"Calculated area information for {entities.Count} {(entities.Count == 1 ? "entity" : "entities")}."); }
public virtual void OnAddToMap(BaseMap map, uint guid, Vector3 vector) { Guid = guid; Map = map; Position = vector; UpdateVision(); }
/// <summary> /// Deserialize the XML file into the game /// </summary> /// <param name="loadSettings">True to load the settings and high scores, or false for just the high scores</param> private void Deserialize(bool loadSettings) { try { // Load the document XDocument doc = XDocument.Load("CoinCollector.xml"); XElement root = doc.Root; // Load the settings if (loadSettings) { Controller.Player.Character = root.Element("Settings").Element("Player").Parse("Character", PlayerCharacter.Suit); } // Load the maps' high scores foreach (XElement mapset in root.Element("Mapsets").Elements("Mapset")) { MapSet set = MapSets.FirstOrDefault(m => m.Filename == mapset.Parse <string>("Filename")); if (set != null) { foreach (XElement map in mapset.Elements("Map")) { BaseMap baseMap = set.Maps.FirstOrDefault(m => m.MapNumber == map.Parse <int>("MapNumber")); if (baseMap != null) { baseMap.HighScore = map.Parse <ulong>("HighScore"); } } } } } catch { } }
/// <summary> /// Generates a new save based on the current game state. /// Do not run this method when the game is not active. /// </summary> /// <returns> Returns whether or not if it was successful</returns> public static bool CreateSave(string SaveName) { GAMESTATE prevGameState = RenderHandler.CurrentGameState; RenderHandler.CurrentGameState = GAMESTATE.PAUSED; GameSave newSave = new GameSave(); PlayerController _player = Game.PlayerCharacter; BaseMap map = RenderHandler.selectedMap; newSave.PlayerPosition = new Vector2(_player.SpriteRectangle.X, _player.SpriteRectangle.Y); newSave.player = (PlayerManager)_player.Manager; newSave.ActiveMap = map.GetType().Namespace + "." + map.GetType().Name; // ------------------------------------------------------------------------------------------------ File.WriteAllText(PathDirectory + SaveName, JsonConvert.SerializeObject(newSave, settings)); RenderHandler.CurrentGameState = prevGameState; // ------------------------------------------------------------------------------------------------ return(true); }
/// <summary> /// Optimizes the map execution /// </summary> /// <returns></returns> public override BaseMap Optimize() { InputMap1 = InputMap1.Optimize(); InputMap2 = InputMap2.Optimize(); return(this); }
public void ItemEnteredMapEventArgsConstructorTest() { BaseItem item = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 ItemEnteredMapEventArgs target = new ItemEnteredMapEventArgs( item, map ); Assert.Inconclusive( "TODO: 实现用来验证目标的代码" ); }
void Start() { GameEvents.OnModulePlaced += UpdateResources; energy.currentAmount = energy.startAmount; oxygen.currentAmount = oxygen.startAmount; food.currentAmount = food.startAmount; water.currentAmount = water.startAmount; //workspace.currentAmount = workspace.startAmount; livingspace.currentAmount = livingspace.startAmount; energy.UpdateUI(); oxygen.UpdateUI(); food.UpdateUI(); water.UpdateUI(); //workspace.UpdateUI(); livingspace.UpdateUI(); grid = GameObject.Find("Grid"); totalres = grid.GetComponent <BaseMap>(); Debug.Log(energy.maxAmount); currentTiles = totalres.currentTiles; InvokeRepeating("UpdateSec", 0, 1); UpdateOnetime(); }
public void MapGenerator_Generates_Correct_Sized_HeightMap(short x, short z) { BaseGenerator <short> mapGenerator = new MapGenerator(x, z, 1); BaseMap <short> map = mapGenerator.GenerateMap(); Assert.True(map.MapData.Count == x * z); }
private static void LoadRegions(XmlElement xml, BaseMap map, Region parent) { foreach (XmlElement xmlReg in xml.SelectNodes("region")) { Type type = DefaultRegionType; ReadType(xmlReg, "type", ref type, false); if (!typeof(Region).IsAssignableFrom(type)) { Console.WriteLine("Invalid region type '{0}' in regions.xml", type.FullName); continue; } Region region = null; try { region = (Region)Activator.CreateInstance(type, new object[] { xmlReg, map, parent }); } catch (Exception ex) { Console.WriteLine("Error during the creation of region type '{0}': {1}", type.FullName, ex); continue; } region.Register(); LoadRegions(xmlReg, map, region); } }
public void MapEventArgsConstructorTest() { BaseMap map = null; // TODO: 初始化为适当的值 MapEventArgs target = new MapEventArgs(map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
private void frmMain_Load(object sender, EventArgs e) { //绑定图层和工具条到map控件 this.axToolbarControl.SetBuddyControl(this.axMapControl); this.axTOCControl.SetBuddyControl(this.axMapControl); //控件填充 this.axMapControl.Dock = DockStyle.Fill; this.axMapControlEagle.Dock = DockStyle.Fill; this.axTOCControl.Dock = DockStyle.Fill; this.ucWorkFlow.Dock = DockStyle.Fill; //获取地图控件引用 m_tocControl = (ITOCControl2)axTOCControl.Object; m_mapControl = (IMapControl3)axMapControl.Object; m_toolBarControl = (IToolbarControl2)axToolbarControl.Object; CMDInitializer.Initialize(m_toolBarControl); //工具条列表 List <Bar> barList = new List <Bar>(); barList.Add(this.barTop); GFSApplication app = new GFSApplication(m_mapControl, (IMapControl3)axMapControlEagle.Object, m_tocControl, m_toolBarControl, this); app.Initialize(barList, appMenu, popupMenuFrame, popupMenulayer, popupMenuRGB, barEditItemLayer, staticSpt, staticXY, staticRaster, barBtnSwipe, barBtnEagleEye, dpEagle, listRecently, controlContainer1); if (Internet.IsConnectInternet()) { BaseMap.Add(BaseMapLayer.ChinaPoi); } }
/// <summary> /// Re-evaluates the entire goal map. Should be called when obstacles change. If the /// obstacles have not changed but the goals have, call <see cref="UpdatePathsOnly" /> for better efficiency. /// </summary> /// <returns>False if no goals were produced by the evaluator, true otherwise</returns> public bool Update() { if (BaseMap.Bounds() != this.Bounds()) { throw new InvalidOperationException( $"Grid views used as the {nameof(BaseMap)} for {nameof(GoalMap)} instances must not change size."); } _walkable.Clear(); for (var y = 0; y < BaseMap.Height; ++y) { for (var x = 0; x < BaseMap.Width; ++x) { var state = BaseMap[x, y]; if (state == GoalState.Obstacle) { _goalMap[x, y] = null; } else { _walkable.Add(new Point(x, y)); } } } return(UpdatePathsOnlyUnchecked()); }
public static void InitializeCheats() { CheatToolsWindow.OnShown = window => { _studioInstance = Studio.Studio.IsInstance() ? Studio.Studio.Instance : null; _soundInstance = Manager.Sound.instance; _sceneInstance = Scene.instance; _gameMgr = Game.IsInstance() ? Game.Instance : null; _baseMap = BaseMap.instance; _hScene = HSceneFlagCtrl.IsInstance() ? HSceneFlagCtrl.Instance : null; _openInInspectorButtons = new[] { new KeyValuePair <object, string>(_gameMgr != null && _gameMgr.heroineList.Count > 0 ? (Func <object>)(() => _gameMgr.heroineList.Select(x => new ReadonlyCacheEntry(GetHeroineName(x), x))) : null, "Heroine list"), new KeyValuePair <object, string>(ADVManager.IsInstance() ? ADVManager.Instance : null, "Manager.ADVManager.Instance"), new KeyValuePair <object, string>(_baseMap, "Manager.BaseMap.instance"), new KeyValuePair <object, string>(Character.IsInstance() ? Character.Instance : null, "Manager.Character.Instance"), new KeyValuePair <object, string>(typeof(Manager.Config), "Manager.Config"), new KeyValuePair <object, string>(_gameMgr, "Manager.Game.Instance"), new KeyValuePair <object, string>(GameSystem.IsInstance() ? GameSystem.Instance : null, "Manager.GameSystem.Instance"), new KeyValuePair <object, string>(_sceneInstance, "Manager.Scene.instance"), new KeyValuePair <object, string>(_soundInstance, "Manager.Sound.instance"), new KeyValuePair <object, string>(_studioInstance, "Studio.Instance"), new KeyValuePair <object, string>((Func <object>)EditorUtilities.GetRootGoScanner, "Root Objects") }; }; CheatToolsWindow.Cheats.Add(new CheatEntry(w => _hScene != null, DrawHSceneCheats, null)); CheatToolsWindow.Cheats.Add(new CheatEntry(w => _baseMap != null && (_hScene != null || Singleton <LobbySceneManager> .IsInstance()), DrawGirlCheatMenu, "Unable to edit character stats on this screen. Start an H scene or enter the lobby.")); CheatToolsWindow.Cheats.Add(CheatEntry.CreateOpenInInspectorButtons(() => _openInInspectorButtons)); CheatToolsWindow.Cheats.Add(new CheatEntry(w => _studioInstance == null && _gameMgr != null && _gameMgr.saveData != null, DrawGlobalUnlocks, null)); HarmonyLib.Harmony.CreateAndPatchAll(typeof(Hooks)); }
private async void GetGames() { CustomGameListView.Items.Clear(); allItems.Clear(); PracticeGameSearchResult[] Games = await Client.PVPNet.ListAllPracticeGames(); foreach (PracticeGameSearchResult game in Games) { GameItem item = new GameItem { GameName = game.Name, GameOwner = game.Owner.SummonerName, Map = BaseMap.GetMap(game.GameMapId).DisplayName, Private = game.PrivateGame.ToString().Replace("True", "Y").Replace("False", ""), Slots = (game.Team1Count + game.Team2Count) + "/" + game.MaxNumPlayers, Spectators = game.SpectatorCount, Type = game.GameModeString.Replace("ODIN", "DOMINION"), Id = game.Id }; if (item.GameName.ToLower().Contains("factions")) { CustomGameListView.Items.Add(item); allItems.Add(item); } } LimitGames(); }
public override void OnAddToMap(BaseMap map, uint guid, Vector3 vector) { base.OnAddToMap(map, guid, vector); CreateFlags &= ~EntityCreateFlag.SpawnAnimation; CreateFlags |= EntityCreateFlag.NoSpawnAnimation; }
public void MapGenerator_Generates_3D_Map(short x, short z, short y) { BaseGenerator <short> mapGenerator = new MapGenerator(x, z, y); BaseMap <short> map = mapGenerator.GenerateMap(); Assert.True(map.MapData.Count > 10); // 10 is arbitrary; just needs to be above a few because the 3d map may not generate blocks at all points in the map }
/// <summary> /// Retrieves one object of type <code>Countries</code> /// </summary> /// <param name="id">The unique identifier which is used to identify an Countries object.</praram> /// <returns> A Countries object </returns> /// <exception cref="ApiCommunicationException"> </exception> /// <exception cref="AuthenticationException"> </exception> /// <exception cref="InvalidRequestException"> </exception> /// <exception cref="NotAllowedException"> </exception> /// <exception cref="ObjectNotFoundException"> </exception> /// <exception cref="SystemException"> </exception> public static Countries Read(String id) { BaseMap map = new BaseMap(); map.Set("id", id); return((Countries)BaseObject.readObject(new Countries(map))); }
public void MapSpaceNodeConstructorTest() { BaseMap owner = null; // TODO: 初始化为适当的值 MapSpaceNode target = new MapSpaceNode(owner); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void Remove(T key, V value) { if (BaseMap.TryGetValue(key, out ICollection <V> list)) { list.Remove(value); } }
private static void PostFixObservableUpdateTriggerStart(BaseMap __instance) { ConsoleLog("attempting start"); if (inMapScreen) { DoTheThing(); } }
public void CreatureEnteringMapEventArgsConstructorTest() { BaseCreature creature = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 CreatureEnteringMapEventArgs target = new CreatureEnteringMapEventArgs(creature, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void Clear() { foreach (var e in BaseMap) { e.Value.Clear(); } BaseMap.Clear(); }
public void PartitionSpaceNodeEventArgsConstructorTest() { MapSpaceNode partitionSpaceNode = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 PartitionSpaceNodeEventArgs target = new PartitionSpaceNodeEventArgs(partitionSpaceNode, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void ProcessSliceEventArgsConstructorTest() { DateTime updateTime = new DateTime(); // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 ProcessSliceEventArgs target = new ProcessSliceEventArgs(updateTime, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void WorldEntityLeavingMapEventArgsConstructorTest() { WorldEntity entity = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 WorldEntityLeavingMapEventArgs target = new WorldEntityLeavingMapEventArgs(entity, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void UpdatedMapEventArgsConstructorTest() { BaseMap baseMap = null; // TODO: 初始化为适当的值 WorldEntity gameEntity = null; // TODO: 初始化为适当的值 UpdatedMapEventArgs target = new UpdatedMapEventArgs(baseMap, gameEntity); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void CharacterLeavingMapEventArgsConstructorTest() { BaseCharacter character = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 CharacterLeavingMapEventArgs target = new CharacterLeavingMapEventArgs(character, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void CharacterMovingInMapEventArgsConstructorTest() { Point3D oldLocation = new Point3D(); // TODO: 初始化为适当的值 BaseCharacter character = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 CharacterMovingInMapEventArgs target = new CharacterMovingInMapEventArgs(oldLocation, character, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void ItemMovedInMapEventArgsConstructorTest() { Point3D oldLocation = new Point3D(); // TODO: 初始化为适当的值 BaseItem item = null; // TODO: 初始化为适当的值 BaseMap map = null; // TODO: 初始化为适当的值 ItemMovedInMapEventArgs target = new ItemMovedInMapEventArgs(oldLocation, item, map); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void MovedToWorldEventArgsConstructorTest() { Point3D oldLocation = new Point3D(); // TODO: 初始化为适当的值 BaseMap oldMap = null; // TODO: 初始化为适当的值 WorldEntity gameEntity = null; // TODO: 初始化为适当的值 MovedToWorldEventArgs target = new MovedToWorldEventArgs(oldLocation, oldMap, gameEntity); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
void Start() { // Calculate the initial offset. offset = new Vector3(0, 0, -1); // Initialize camera cam = Camera.main; // Get orthographic camera height and width height = 2f * cam.orthographicSize; width = height * cam.aspect; mapSettings = GameObject.Find("Map").GetComponent<BaseMap>(); roomWidth = mapSettings.roomWidth * mapSettings.tileSize; roomHeight = mapSettings.roomHeight * mapSettings.tileSize; }
public CreateWebMapObject() { InitializeComponent(); //Define BaseMap Layer basemap = new BaseMap() { Layers = new List<WebMapLayer> { new WebMapLayer { Url = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" } } }; //Add a ArcGISDynamicMapService operationLayers.Add(new WebMapLayer { Url = "http://serverapps10.esri.com/ArcGIS/rest/services/California/MapServer", VisibleLayers = new List<object> { 0, 1, 3, 6, 9 } }); //Define popup IList<FieldInfo> fieldinfos = new List<FieldInfo>(); fieldinfos.Add(new FieldInfo() { FieldName = "STATE_NAME", Label = "State", Visible = true }); IList<MediaInfo> mediainfos = new List<MediaInfo>(); MediaInfoValue infovalue = new MediaInfoValue(); infovalue.Fields = new string[] { "POP2000,POP2007" }; mediainfos.Add(new MediaInfo() { Type = MediaType.PieChart, Value = infovalue }); PopupInfo popup = new PopupInfo() { FieldInfos = fieldinfos, MediaInfos = mediainfos, Title = "Population Change between 2000 and 2007", }; //Add a Feature Layer with popup operationLayers.Add(new WebMapLayer { Url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3", Mode = FeatureLayer.QueryMode.OnDemand, PopupInfo = popup }); //Perform Query to get a featureSet and add to webmap as featurecollection QueryTask qt = new QueryTask() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0" }; qt.ExecuteCompleted += qt_ExecuteCompleted; ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query(); query.OutFields.Add("*"); query.Where = "magnitude > 3.5"; query.ReturnGeometry = true; qt.Failed += (a, b) => { MessageBox.Show("QueryTask failed to execute:" + b.Error); }; qt.ExecuteAsync(query); }
void Start () { mapSettings = GameObject.Find("Map").GetComponent<BaseMap>(); roomWidth = mapSettings.roomWidth * mapSettings.tileSize; roomHeight = mapSettings.roomHeight * mapSettings.tileSize; roomGridX = mapSettings.roomGridX; roomGridY = mapSettings.roomGridY; posCorrectionX = (roomWidth % 2 == 0) ? 1 : 0; posCorrectionY = (roomHeight % 2 == 0) ? 1 : 0; InstanciatePanels(); InitialiseMinimap(); StartCoroutine("PositionUpdate"); }
protected virtual void applyMapping( Type controlType, object control, BaseMap mapping, ViewFactory factory, BuildContext context) { foreach (var pm in mapping.PropertyMaps) { if (tryParseComplexValue(controlType, control, factory, context, pm)) continue; switch (pm.Kind) { case PropertyMap.EKind.Value: setControlProperty(controlType, control, factory, context, pm); break; case PropertyMap.EKind.Event: addEventHandler(controlType, control, factory, context, pm); break; } } }
public static void Set(Type forType, BaseMap map) { _mappingHash[forType] = map; }