void ShowCountry() { var selectedCastle = selectedTile as CastleSpawnTile; if (selectedCastle != null) { if (selectedCastle.countryData == null) { EditorGUILayout.LabelField("Country Data not found.", EditorStyles.boldLabel); return; } if (selectedCountry != selectedCastle.countryData) { selectedCountry = selectedCastle.countryData; } EditorGUILayout.LabelField("Name: " + selectedCastle.countryData.country.countryName, EditorStyles.boldLabel); EditorGUILayout.Separator(); if (subEditor != null) { subEditor.DrawDefaultInspector(); } if (!removeCountryConfirmation && GUILayout.Button("Remove")) { removeCountryConfirmation = true; } if (removeCountryConfirmation) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Confirm")) { removeCountryConfirmation = false; spawnMap.SetTile(selectedCastle.position, null); currentMap.countryDataObjectDictionary.Remove(selectedCastle.countryData.country.countryID); currentMap.castleSpawnTileDictionary.Remove(selectedCastle.position); currentMap.Save(); DestroyImmediate(selectedCastle.countryData, true); DestroyImmediate(selectedCastle, true); } if (GUILayout.Button("Cancel")) { removeCountryConfirmation = false; } GUILayout.EndHorizontal(); } } }
public void CountryPostTest(IDictionary testData) { #region Arrange var currentEntity = new CountryDataObject(); var include = ""; var token = ""; currentEntity.IsNew = Convert.ToBoolean(testData["IsNew"].ToString()); if (!currentEntity.IsNew) { currentEntity.URI = testData["URI"].ToString().Trim() != null ? testData["URI"].ToString().Trim().ToString() : null; include = testData["Include"].ToString().Trim(); } currentEntity.Abstract = testData["Abstract"]?.ToString().Trim() != null ? testData["Abstract"]?.ToString().Trim().ToString() : null; currentEntity.Flag = testData["Flag"]?.ToString().Trim() != null ? testData["Flag"]?.ToString().Trim().ToString() : null; currentEntity.LongName = testData["Long Name"]?.ToString().Trim() != null ? testData["Long Name"]?.ToString().Trim().ToString() : null; currentEntity.Name = testData["Name"]?.ToString().Trim() != null ? testData["Name"]?.ToString().Trim().ToString() : null; currentEntity.PopulationDensity = testData["Population Density"]?.ToString().Trim() == null ? (decimal?)null : Convert.ToDecimal(testData["Population Density"]?.ToString().Trim().Replace(".", ",")); currentEntity.PopulationTotal = Convert.ToInt64(testData["Population Total"]?.ToString().Trim()); var expected_result = ConvertToStatusCode(testData["Result"]); #endregion #region Act var json = JsonConvert.SerializeObject(currentEntity); var postUrl = APITestManager.doPostRequestBody(json, include); APIWebRequest request = new APIWebRequest(); var username = testData["Username"].ToString().Trim(); var password = testData["Password"].ToString().Trim(); token = request.getToken(APITestManager.getAuthenticateUrl(), username, password); using (var testResponse = request.ProcessAPIWebRequest(appUrl, APIWebRequest.TypeCall.Save, postUrl, token)) { var status_code = testResponse.StatusCode; var status_description = testResponse.Status; var response_body = testResponse.Body; #endregion #region Assert APITestManager.displayResponse(testResponse); Assert.AreEqual(expected_result, status_code); if (status_code == HttpStatusCode.OK) { // to be implemented } #endregion } }
private void Initialize() { initSuccessful = true; database = (GameDatabase)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/GameDataObjects/GameDatabase.asset", typeof(GameDatabase)); mapDatabase = (MapDatabase)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/MapDataObjects/MapDatabase.asset", typeof(MapDatabase)); if (database == null) { initSuccessful = false; Debug.Log("Cannot find GameDatabase"); } if (mapDatabase == null) { initSuccessful = false; Debug.Log("Cannot find MapDatabase"); } else { mapDatabase.InitDictionary(); } InitTextures(); SceneView.onSceneGUIDelegate += OnSceneGUI; var terrain = GameObject.Find("TerrainMap"); if (terrain) { tilemapParent = terrain.transform; } var map = GameObject.Find("SpawnMap"); if (map != null) { spawnMap = map.transform.Find("Spawn").GetComponent <Tilemap>(); } else { initSuccessful = false; Debug.Log("Cannot find SpawnMap"); } selectedCountry = null; selectedCreateType = MapDataType.None; Tools.current = Tool.None; Tools.hidden = true; }
public void Initialize(CountryDataObject countryData) { }