Пример #1
0
 private void UpdateParameter()
 {
     // avoid unecessary iterations
     if (isUpdating)
     {
         return;
     }
     isUpdating = true;
     // Cleanup
     foreach (Transform child in parameterContent.transform)
     {
         GameObject.Destroy(child.gameObject);
     }
     // Update if enabled
     if (parameters != null && _typeDropdown.interactable)
     {
         GenericParameter param = parameters[_paramsList.SelectedItem];
         if (param.type >= _typeDropdown.options.Count || param.type < 0)
         {
             RetroBread.Debug.LogError("Unknown parameter type " + param.type + ", parameter data removed");
             param = new RetroBread.Editor.GenericParameter();
         }
         _typeDropdown.value = param.type;
         parameterBuilder.Build(parameterContent, param);
     }
     isUpdating = false;
 }
Пример #2
0
 public static string SafeIntsListToString(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureIntsListItem(index);
     return(string.Join(", ",
                        parameter.intsListList[index].Select(x => x + "").ToArray()
                        ));
 }
 public static int SafeInt(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureIntItem(index);
     return(parameter.intsList[index]);
 }
 public static string SafeBoolToString(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureBoolItem(index);
     return(parameter.boolsList[index] ? "true" : "false");
 }
 public static string SafeFloatToString(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureFloatItem(index);
     return(((float)parameter.floatsList[index]).ToString("0.###"));
 }
 public static bool SafeBool(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureBoolItem(index);
     return(parameter.boolsList[index]);
 }
 public static string SafeString(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureStringItem(index);
     return(parameter.stringsList[index]);
 }
 public static FixedFloat SafeFloat(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureFloatItem(index);
     return(parameter.floatsList[index]);
 }
Пример #9
0
 public static string SafeStringsListToString(this Editor.GenericParameter parameter, int index)
 {
     parameter.EnsureStringsListItem(index);
     return(string.Join(", ", parameter.stringsListList[index].ToArray()));
 }
        public bool IsEqual(GenericParameter other)
        {
            // warning: ugly code ahead
            if (type != other.type)
            {
                return(false);
            }
            if ((intsList == null) != (other.intsList == null))
            {
                return(false);
            }
            if ((floatsList == null) != (other.floatsList == null))
            {
                return(false);
            }
            if ((stringsList == null) != (other.stringsList == null))
            {
                return(false);
            }
            if ((boolsList == null) != (other.boolsList == null))
            {
                return(false);
            }

            if (intsList != null)
            {
                if (intsList.Count != other.intsList.Count)
                {
                    return(false);
                }
                for (int i = 0; i < intsList.Count; ++i)
                {
                    if (intsList[i] != other.intsList[i])
                    {
                        return(false);
                    }
                }
            }
            if (floatsList != null)
            {
                if (floatsList.Count != other.floatsList.Count)
                {
                    return(false);
                }
                for (int i = 0; i < floatsList.Count; ++i)
                {
                    if (floatsList[i] != other.floatsList[i])
                    {
                        return(false);
                    }
                }
            }
            if (stringsList != null)
            {
                if (stringsList.Count != other.stringsList.Count)
                {
                    return(false);
                }
                for (int i = 0; i < stringsList.Count; ++i)
                {
                    if (stringsList[i] != other.stringsList[i])
                    {
                        return(false);
                    }
                }
            }
            if (boolsList != null)
            {
                if (boolsList.Count != other.boolsList.Count)
                {
                    return(false);
                }
                for (int i = 0; i < boolsList.Count; ++i)
                {
                    if (boolsList[i] != other.boolsList[i])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }