private void DrawCreateNewVersionButton() { EditorGUI.BeginDisabledGroup(!_varwinObjectDescriptor.CurrentVersionWasBuilt); if (GUILayout.Button("Create new version")) { string message = @"Create a new version of the object?"; if (EditorUtility.DisplayDialog("Create a new version of the object", message, "Yes", "Cancel")) { _varwinObjectDescriptor.Guid = Guid.NewGuid().ToString(); _varwinObjectDescriptor.CurrentVersionWasBuilt = false; if (EditorUtility.DisplayDialog("Varwin Object Build Dialog", "Build new version of object? Editor will proceed to object building.", "Yes", "Cancel")) { if (CreateObjectUtils.ContainsObjectIdDuplicates(_gameObject)) { if (!DisplayDuplicatesObjectIdsDialog()) { return; } } if (!CheckTypesForValid()) { return; } BuildVarwinObject(_varwinObjectDescriptor); return; } } } EditorGUI.EndDisabledGroup(); }
public async Task CreateEquipment(string name, int atk, int def, int cost, int levelReq) { try { CreateObjectUtils.CreateEquipmentInShop(name, atk, def, cost, levelReq); await ReplyAsync($"Equipment Created"); } catch (Exception ex) { await Logger.Log(new LogMessage(LogSeverity.Error, GetType().Name + ".createEquiment", "Unexpected Exception", ex)); } }
public void MoveRoles() { var rol = Util.LoadAllRolesFromServer(); foreach (var r in rol) { DatabaseUtils.ChangeCollection("roles"); CreateObjectUtils.CreateRoleInDatabase(r._id, r.description, r.difficulty); } }
private void OnObjectBuilt(System.Object sender, EventArgs eventArgs) { var varwinObject = (VarwinObjectDescriptor)target; ObjectsBuilderWindow window = GetWindow(); if (window != null) { window.ObjectBuilt -= OnObjectBuilt; } CreateObjectUtils.RevertPrefabInstanceChanges(varwinObject.gameObject); }
private bool CheckTypesForValid() { var invalidTypes = new List <string>(); if (!CreateObjectUtils.ValidateAssemblies(ref invalidTypes, _gameObject, _objectName)) { foreach (var invalidType in invalidTypes) { EditorUtility.DisplayDialog("Invalid script assembly", $"{invalidType} is not a valid assembly! Move this script to the object folder or create a new reference inside the Assembly Definition", "OK"); return(false); } } return(true); }
private void DrawBuildButton() { bool isDisabled = !IsSelectable() || string.IsNullOrWhiteSpace(_nameProperty.stringValue) || string.IsNullOrWhiteSpace(_authorNameProperty.stringValue); EditorGUI.BeginDisabledGroup(isDisabled); if (GUILayout.Button("Build")) { if (CreateObjectUtils.ContainsObjectIdDuplicates(_gameObject)) { if (!DisplayDuplicatesObjectIdsDialog()) { return; } } if (!CheckTypesForValid()) { return; } if (EditorUtility.DisplayDialog("Varwin Object Build Dialog", "Editor will proceed to object building", "Yes", "Cancel")) { BuildVarwinObject(_varwinObjectDescriptor); return; } } if (!string.Equals(_varwinObjectDescriptor.Guid, _varwinObjectDescriptor.RootGuid) || _varwinObjectDescriptor.CurrentVersionWasBuilt) { DrawCreateNewVersionButton(); } EditorGUI.EndDisabledGroup(); if (string.IsNullOrWhiteSpace(_nameProperty.stringValue)) { EditorGUILayout.HelpBox("Object type name is empty", MessageType.Error); } if (!IsSelectable()) { EditorGUILayout.HelpBox("Object is not selectable. Add Rigidbody and Collider to the root object", MessageType.Error); } if (CreateObjectUtils.ContainsObjectIdDuplicates(_gameObject)) { EditorGUILayout.HelpBox("Object contains duplicate Object Ids", MessageType.Warning); } }
public void BuildVarwinObject(VarwinObjectDescriptor varwinObjectDescriptor) { varwinObjectDescriptor.PreBuild(); CreateObjectUtils.ApplyPrefabInstanceChanges(varwinObjectDescriptor.gameObject); VarwinObjectDescriptor varwinPrefab = CreateObjectUtils.GetPrefab(varwinObjectDescriptor.gameObject).GetComponent <VarwinObjectDescriptor>(); ObjectsBuilderWindow.BuildVarwinObject(varwinObjectDescriptor); ObjectsBuilderWindow window = GetWindow(); if (window != null) { window.ObjectBuilt += OnObjectBuilt; } }
public async Task EnterCompetition() { var user = ((SocketGuildUser)Context.Message.Author); UsersEntered userInCompetition = ObjectUtils.GetUsersInCompetition("_id", user.Id); if (user.JoinedAt > DateTime.Today.AddDays(-7)) { await ReplyAsync($"You have joined the server too recently to enter!"); } else if (userInCompetition != null) { await ReplyAsync($"You have already joined the competition!"); } else { CreateObjectUtils.CreateUserInCompetition(user); await ReplyAsync($"You have joined the competition, Good Luck!"); } }
private bool DisplayDuplicatesObjectIdsDialog() { if (EditorUtility.DisplayDialog("Varwin Object Build Dialog", $"Object contains duplicate Object Ids. Remove duplicates?", "OK", "Cancel")) { var duplicates = CreateObjectUtils.GetObjectIdDuplicates(_gameObject); var rootObjectId = _gameObject.GetComponent <ObjectId>(); if (rootObjectId != null) { if (duplicates.Contains(rootObjectId)) { duplicates.Remove(rootObjectId); } } foreach (var duplicate in duplicates) { CreateObjectUtils.SafeDestroy(duplicate); } return(true); } return(false); }
public static async Task CreateUserInDatabase(SocketUser userName, ulong id) { CreateObjectUtils.CreateUserInDatabase(userName); await GiveRoleToUser(userName as SocketGuildUser, "Family", id); }
public async Task MakeRoles(string name, string description, int difficulty) { CreateObjectUtils.CreateRoleInDatabase(name, description, difficulty); await ReplyAsync($"Role has been inserted into the database"); await CreateRoles(); }