void DrawStartsQuest() { Rect templateRect = new Rect (210, Screen.height - 350, 200, 300); GUILayout.BeginArea (templateRect, skin.GetStyle ("Window")); GUILayout.Label ("Starts Quests:"); selectedListScrollPosition = GUILayout.BeginScrollView (selectedListScrollPosition, false, true); // Draw Display names int pos = 0; foreach (int questID in spawnInCreation.startsQuests) { QuestTemplate tmpl = GetQuestTemplate (questID); if (GUILayout.Button (tmpl.questID + ". " + tmpl.title)) { spawnInCreation.startsQuests.Remove (tmpl.questID); break; } pos++; } GUILayout.EndScrollView (); GUILayout.Label ("Available Quests:"); questListScrollPosition = GUILayout.BeginScrollView (questListScrollPosition, false, true); // Draw Display names pos = 0; foreach (QuestTemplate tmpl in questTemplates) { if (!spawnInCreation.startsQuests.Contains (tmpl.questID)) { if (GUILayout.Button (tmpl.questID + ". " + tmpl.title)) { spawnInCreation.startsQuests.Add (tmpl.questID); break; } pos++; } } GUILayout.EndScrollView (); if (GUILayout.Button ("Close")) { propertySelectState = MobPropertySelectState.None; AtavismUiSystem.RemoveFrame ("MobInteraction", new Rect (0, 0, 0, 0)); } GUILayout.EndArea (); }
// Use this for initialization void Start() { mobCreationState = MobCreationState.Disabled; propertySelectState = MobPropertySelectState.None; NetworkAPI.RegisterExtensionMessageHandler ("world_developer_response", WorldDeveloperHandler); NetworkAPI.RegisterExtensionMessageHandler ("mobTemplates", HandleMobTemplateUpdate); NetworkAPI.RegisterExtensionMessageHandler ("questTemplates", HandleQuestTemplateUpdate); NetworkAPI.RegisterExtensionMessageHandler ("dialogueTemplates", HandleDialogueTemplateUpdate); NetworkAPI.RegisterExtensionMessageHandler ("merchantTables", HandleMerchantTableUpdate); NetworkAPI.RegisterExtensionMessageHandler ("add_visible_spawn_marker", HandleSpawnList); NetworkAPI.RegisterExtensionMessageHandler ("spawn_data", HandleSpawnData); // Verify we have access CheckAccess(); }
void DrawSpawnPositioning() { Rect templateRect = new Rect (210, Screen.height - 350, 200, 250); GUILayout.BeginArea (templateRect, skin.GetStyle ("Window")); // Allow manual editing of the position GUILayout.Label("Position:"); Vector3 position = spawnInCreation.marker.transform.position; GUILayout.BeginHorizontal(); GUILayout.Label("x:"); string posX = GUILayout.TextField(position.x.ToString("0.00")); position.x = float.Parse(posX); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("y:"); string posY = GUILayout.TextField(position.y.ToString("0.00")); position.y = float.Parse(posY); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("z:"); string posZ = GUILayout.TextField(position.z.ToString("0.00")); position.z = float.Parse(posZ); GUILayout.EndHorizontal(); spawnInCreation.marker.transform.position = position; spawnInCreation.position = position; if (GUILayout.Button ("Move to Player")) { spawnInCreation.marker.transform.position = ClientAPI.GetPlayerObject().Position; spawnInCreation.marker.transform.rotation = ClientAPI.GetPlayerObject().Orientation; spawnInCreation.position = ClientAPI.GetPlayerObject().Position; spawnInCreation.orientation = ClientAPI.GetPlayerObject().Orientation; } if (GUILayout.Button ("Close")) { propertySelectState = MobPropertySelectState.None; AtavismUiSystem.RemoveFrame ("MobInteraction", new Rect (0, 0, 0, 0)); } GUILayout.EndArea (); }
void DrawSpawnMob() { Rect templateRect = new Rect (10, 100, 200, 430); GUILayout.BeginArea (templateRect, skin.GetStyle ("Window")); GUILayout.BeginHorizontal (); GUILayout.Label ("Mob Spawner"); GUILayout.FlexibleSpace (); if (GUILayout.Button ("X")) { StartBuilder(false); } GUILayout.EndHorizontal (); GUILayout.Label ("Template: " + spawnInCreation.GetMobTemplateName ()); if (GUILayout.Button ("Change Template")) { propertySelectState = MobPropertySelectState.MobTemplate; selectedListScrollPosition = Vector2.zero; } GUILayout.Label ("Roam Radius: " + spawnInCreation.roamRadius.ToString ("N1")); spawnInCreation.roamRadius = GUILayout.HorizontalSlider (spawnInCreation.roamRadius, 0.0f, 10.0f); //GUILayout.BeginHorizontal(); GUILayout.Label ("Despawn Time: " + spawnInCreation.despawnTime + " secs"); spawnInCreation.despawnTime = (int)GUILayout.HorizontalSlider (spawnInCreation.despawnTime, 5.0f, 300.0f); //GUILayout.EndHorizontal(); //GUILayout.BeginHorizontal(); GUILayout.Label ("Respawn Time: " + spawnInCreation.respawnTime + " secs"); spawnInCreation.respawnTime = (int)GUILayout.HorizontalSlider (spawnInCreation.respawnTime, 5.0f, 300.0f); GUILayout.BeginHorizontal (); GUILayout.Label ("Pickup Item: "); string pickupItem = GUILayout.TextField ("" + spawnInCreation.pickupItemID); spawnInCreation.pickupItemID = int.Parse (pickupItem); GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); GUILayout.Label ("Is Chest: "); spawnInCreation.isChest = GUILayout.Toggle (spawnInCreation.isChest, ""); GUILayout.EndHorizontal (); GUILayout.BeginHorizontal(); if (GUILayout.Button ("Starts Quests")) { propertySelectState = MobPropertySelectState.StartQuest; selectedListScrollPosition = Vector2.zero; questListScrollPosition = Vector2.zero; } if (GUILayout.Button ("Ends Quests")) { propertySelectState = MobPropertySelectState.EndQuest; selectedListScrollPosition = Vector2.zero; questListScrollPosition = Vector2.zero; } GUILayout.EndHorizontal (); if (GUILayout.Button ("Dialogues")) { propertySelectState = MobPropertySelectState.StartDialogue; selectedListScrollPosition = Vector2.zero; questListScrollPosition = Vector2.zero; } if (GUILayout.Button ("Merchant Table: " + spawnInCreation.merchantTable)) { propertySelectState = MobPropertySelectState.MerchantTable; selectedListScrollPosition = Vector2.zero; questListScrollPosition = Vector2.zero; } GUILayout.FlexibleSpace(); if (spawnInCreation.mobTemplate != null && mobCreationState == MobCreationState.SpawnMob) { if (GUILayout.Button ("Spawn Here")) { SpawnMobHere (); } } else if (spawnInCreation.mobTemplate != null && mobCreationState == MobCreationState.EditSpawn) { if (GUILayout.Button ("Edit Position")) { propertySelectState = MobPropertySelectState.SpawnPositioning; } GUILayout.BeginHorizontal(); if (GUILayout.Button ("Save")) { UpdateSpawn(); StartBuilder(false); } if (GUILayout.Button ("Cancel")) { StartBuilder(false); } GUILayout.EndHorizontal(); GUILayout.Space (10); if (GUILayout.Button ("Delete")) { DeleteSpawn(); StartBuilder(false); } } else { GUILayout.Space (20); } GUILayout.EndArea (); }
void DrawMobTemplateSelection() { Rect templateRect = new Rect (210, Screen.height - 350, 200, 250); GUILayout.BeginArea (templateRect, skin.GetStyle ("Window")); GUILayout.Label ("Mob Templates:"); templateListScrollPosition = GUILayout.BeginScrollView (templateListScrollPosition, false, true); // Draw Display names int pos = 0; foreach (MobTemplate tmpl in mobTemplates) { if (GUILayout.Button (tmpl.ID + ". " + tmpl.name)) { spawnInCreation.mobTemplate = tmpl; spawnInCreation.mobTemplateID = tmpl.ID; propertySelectState = MobPropertySelectState.None; AtavismUiSystem.RemoveFrame ("MobInteraction", new Rect (0, 0, 0, 0)); } pos++; } GUILayout.EndScrollView (); if (GUILayout.Button ("Close")) { propertySelectState = MobPropertySelectState.None; AtavismUiSystem.RemoveFrame ("MobInteraction", new Rect (0, 0, 0, 0)); } GUILayout.EndArea (); }
void DrawMerchantTables() { Rect templateRect = new Rect (210, Screen.height - 350, 200, 250); GUILayout.BeginArea (templateRect, skin.GetStyle ("Window")); GUILayout.Label ("Merchant Tables:"); questListScrollPosition = GUILayout.BeginScrollView (questListScrollPosition, false, true); // Draw Display names foreach (MerchantTableTemplate tmpl in merchantTables) { if (GUILayout.Button (tmpl.tableID + ". " + tmpl.title)) { spawnInCreation.merchantTable = tmpl.tableID; propertySelectState = MobPropertySelectState.None; AtavismUiSystem.RemoveFrame ("MobInteraction", new Rect (0, 0, 0, 0)); break; } } GUILayout.EndScrollView (); GUILayout.EndArea (); }
public void StartBuilder(bool getTemplates) { if (getTemplates) GetMobTemplates (); mobCreationState = MobCreationState.Menu; propertySelectState = MobPropertySelectState.None; AtavismUiSystem.AddFrame ("MobSpawn", new Rect (10, 100, 200, 200)); }