Example #1
0
    public void CreateCustomCubeoid()
    {
        bool valid = true;

        if (CustomCubeoidNameText.text.Equals(""))
        {
            ColorBlock c = CustomCubeoidNameText.colors;
            c.normalColor = Color.red;
            CustomCubeoidNameText.colors = c;
            valid = false;
        }
        else
        {
            ColorBlock c = CustomCubeoidNameText.colors;
            c.normalColor = Color.white;
            CustomCubeoidNameText.colors = c;
        }
        if (CustomCubeoidWidthText.text.Equals("") || float.Parse(CustomCubeoidWidthText.text) > MaxCubeoidDimensions)
        {
            ColorBlock c = CustomCubeoidWidthText.colors;
            c.normalColor = Color.red;
            CustomCubeoidWidthText.colors = c;
            valid = false;
        }
        else
        {
            ColorBlock c = CustomCubeoidWidthText.colors;
            c.normalColor = Color.white;
            CustomCubeoidWidthText.colors = c;
        }
        if (CustomCubeoidHeightText.text.Equals("") || float.Parse(CustomCubeoidHeightText.text) > MaxCubeoidDimensions)
        {
            ColorBlock c = CustomCubeoidHeightText.colors;
            c.normalColor = Color.red;
            CustomCubeoidHeightText.colors = c;
            valid = false;
        }
        else
        {
            ColorBlock c = CustomCubeoidHeightText.colors;
            c.normalColor = Color.white;
            CustomCubeoidHeightText.colors = c;
        }
        if (CustomCubeoidDepthText.text.Equals("") || float.Parse(CustomCubeoidDepthText.text) > MaxCubeoidDimensions)
        {
            ColorBlock c = CustomCubeoidDepthText.colors;
            c.normalColor = Color.red;
            CustomCubeoidDepthText.colors = c;
            valid = false;
        }
        else
        {
            ColorBlock c = CustomCubeoidDepthText.colors;
            c.normalColor = Color.white;
            CustomCubeoidDepthText.colors = c;
        }

        if ((!CustomCubeoidWidthText.text.Equals("") && float.Parse(CustomCubeoidWidthText.text) > MaxCubeoidDimensions) || (!CustomCubeoidHeightText.text.Equals("") && float.Parse(CustomCubeoidHeightText.text) > MaxCubeoidDimensions) || (!CustomCubeoidDepthText.text.Equals("") && float.Parse(CustomCubeoidDepthText.text) > MaxCubeoidDimensions))
        {
            string message = SmartLocalization.LanguageManager.Instance.GetTextValue("CustomCubeoid.MaxLimit");
            DialogManager.instance.ShowDialog(message, "", DialogManager.ButtonType.Okay);
        }

        if (valid)
        {
            customCubeoidPanelShown = false;
            GameObject cubeoid = editorManager.CreateCustomCubeoid(CustomCubeoidNameText.text, GetCubeoidDropdownColor(), float.Parse(CustomCubeoidWidthText.text), float.Parse(CustomCubeoidHeightText.text), float.Parse(CustomCubeoidDepthText.text));
            AddPart(CustomCubeoidNameText.text, cubeoid);
            CustomCubeoidNameText.text   = "";
            CustomCubeoidWidthText.text  = "";
            CustomCubeoidHeightText.text = "";
            CustomCubeoidDepthText.text  = "";
        }
    }