diff --git a/Editor/AGS.Editor/Components/GlobalVariablesComponent.cs b/Editor/AGS.Editor/Components/GlobalVariablesComponent.cs index b7d55aee66..e4223da3c6 100644 --- a/Editor/AGS.Editor/Components/GlobalVariablesComponent.cs +++ b/Editor/AGS.Editor/Components/GlobalVariablesComponent.cs @@ -63,10 +63,10 @@ private string GenerateGlobalVariablesScriptModule(IList variabl string declaration = $"{variable.Type} {variable.Name}"; switch (variable.ArrayType) { - case VariableArrayType.Array: + case GlobalVariableArrayType.Array: declaration = declaration + $"[{variable.ArraySize}]"; break; - case VariableArrayType.DynamicArray: + case GlobalVariableArrayType.DynamicArray: declaration = declaration + $"[]"; break; } @@ -103,13 +103,13 @@ private void UpdateScriptHeader() { switch (variable.ArrayType) { - case VariableArrayType.None: + case GlobalVariableArrayType.None: sb.AppendLine($"import {variable.Type} {variable.Name};"); break; - case VariableArrayType.Array: + case GlobalVariableArrayType.Array: sb.AppendLine($"import {variable.Type} {variable.Name}[{variable.ArraySize}];"); break; - case VariableArrayType.DynamicArray: + case GlobalVariableArrayType.DynamicArray: sb.AppendLine($"import {variable.Type} {variable.Name}[];"); break; } diff --git a/Editor/AGS.Editor/GUI/GlobalVariableDialog.cs b/Editor/AGS.Editor/GUI/GlobalVariableDialog.cs index 6eb07156a5..cd1c496693 100644 --- a/Editor/AGS.Editor/GUI/GlobalVariableDialog.cs +++ b/Editor/AGS.Editor/GUI/GlobalVariableDialog.cs @@ -94,8 +94,8 @@ private void btnOK_Click(object sender, EventArgs e) _variable.Name = txtName.Text; _variable.DefaultValue = txtDefaultValue.Text; _variable.Type = cmbType.SelectedItem.ToString(); - _variable.ArrayType = (VariableArrayType)cmbArray.SelectedIndex; - _variable.ArraySize = _variable.ArrayType == VariableArrayType.Array ? (int)udArraySize.Value : 0; + _variable.ArrayType = (GlobalVariableArrayType)cmbArray.SelectedIndex; + _variable.ArraySize = _variable.ArrayType == GlobalVariableArrayType.Array ? (int)udArraySize.Value : 0; this.DialogResult = DialogResult.OK; this.Close(); } @@ -115,8 +115,8 @@ private void cmbType_SelectedIndexChanged(object sender, EventArgs e) private void cmbArray_SelectedIndexChanged(object sender, EventArgs e) { - VariableArrayType arrType = (VariableArrayType)cmbArray.SelectedIndex; - if (arrType == VariableArrayType.None) + GlobalVariableArrayType arrType = (GlobalVariableArrayType)cmbArray.SelectedIndex; + if (arrType == GlobalVariableArrayType.None) { label5.Enabled = false; udArraySize.Enabled = false; @@ -124,8 +124,8 @@ private void cmbArray_SelectedIndexChanged(object sender, EventArgs e) } else { - label5.Enabled = arrType == VariableArrayType.Array; - udArraySize.Enabled = arrType == VariableArrayType.Array; + label5.Enabled = arrType == GlobalVariableArrayType.Array; + udArraySize.Enabled = arrType == GlobalVariableArrayType.Array; // TODO: maybe support array initialization? although it's not convenient to do with a single textbox txtDefaultValue.Enabled = false; txtDefaultValue.Text = string.Empty; diff --git a/Editor/AGS.Editor/Panes/GlobalVariablesEditor.cs b/Editor/AGS.Editor/Panes/GlobalVariablesEditor.cs index a329f289d2..17c84b00fe 100644 --- a/Editor/AGS.Editor/Panes/GlobalVariablesEditor.cs +++ b/Editor/AGS.Editor/Panes/GlobalVariablesEditor.cs @@ -106,8 +106,8 @@ private void FillListItemFromVariable(ListViewItem item, GlobalVariable variable string varType; switch (variable.ArrayType) { - case VariableArrayType.Array: varType = $"{variable.Type}[{variable.ArraySize}]"; break; - case VariableArrayType.DynamicArray: varType = $"{variable.Type}[]"; break; + case GlobalVariableArrayType.Array: varType = $"{variable.Type}[{variable.ArraySize}]"; break; + case GlobalVariableArrayType.DynamicArray: varType = $"{variable.Type}[]"; break; default: varType = variable.Type; break; } diff --git a/Editor/AGS.Types/GlobalVariable.cs b/Editor/AGS.Types/GlobalVariable.cs index 08bd884a47..973fcffc46 100644 --- a/Editor/AGS.Types/GlobalVariable.cs +++ b/Editor/AGS.Types/GlobalVariable.cs @@ -6,9 +6,9 @@ namespace AGS.Types { /// - /// VariableArrayType provides variable's qualification as an array. + /// GlobalVariableArrayType provides variable's qualification as an array. /// - public enum VariableArrayType + public enum GlobalVariableArrayType { None, // not an array, regular variable Array, // static, fixed-sized array @@ -20,7 +20,7 @@ public class GlobalVariable private string _name = string.Empty; private string _type = string.Empty; private string _defaultValue = string.Empty; - private VariableArrayType _arrayType = VariableArrayType.None; + private GlobalVariableArrayType _arrayType = GlobalVariableArrayType.None; private int _arraySize = 0; public GlobalVariable() { } @@ -43,7 +43,7 @@ public string DefaultValue set { _defaultValue = value; } } - public VariableArrayType ArrayType + public GlobalVariableArrayType ArrayType { get { return _arrayType; } set { _arrayType = value; }