Beispiel #1
0
        public void Draw(TextBuilder text, TextBatcher textBatcher, DemoSet demoSet, Vector2 position, float textHeight, Vector3 textColor, Font font)
        {
            if (TrackingInput)
            {
                text.Clear().Append("Swap demo to: ");
                if (TargetDemoIndex >= 0)
                {
                    text.Append(TargetDemoIndex);
                }
                else
                {
                    text.Append("_");
                }
                textBatcher.Write(text, position, textHeight, textColor, font);

                var lineSpacing = textHeight * 1.1f;
                position.Y += textHeight * 0.5f;
                textHeight *= 0.8f;
                for (int i = 0; i < demoSet.Count; ++i)
                {
                    position.Y += lineSpacing;
                    text.Clear().Append(demoSet.GetName(i));
                    textBatcher.Write(text.Clear().Append(i).Append(": ").Append(demoSet.GetName(i)), position, textHeight, textColor, font);
                }
            }
        }
    void SetDemoSet(int setIndex)
    {
        if (setIndex >= sets.Length)
        {
            return;
        }

        DemoSet newSet;

        if (setIndex < 0)
        {
            newSet = new DemoSet(ramps, lookups);
        }
        else
        {
            newSet = sets[setIndex];
        }

        for (int i = 0; i < materials.Count; i++)
        {
            if (materials[i].HasProperty("_Color"))
            {
                materials[i].SetColor("_Color", newSet._Color);
            }
            if (materials[i].HasProperty("_Color1"))
            {
                materials[i].SetColor("_Color1", newSet._Color1);
            }

            if (materials[i].HasProperty("_Ramp"))
            {
                materials[i].SetTexture("_Ramp", newSet._Ramp);
            }
            if (materials[i].HasProperty("_Lookup"))
            {
                materials[i].SetTexture("_Lookup", newSet._Lookup);
            }
            if (materials[i].HasProperty("_ColorControl"))
            {
                materials[i].SetTexture("_ColorControl", newSet._ColorControl);
            }

            if (materials[i].HasProperty("_Threshold"))
            {
                materials[i].SetFloat("_Threshold", newSet._Threshold);
            }
            if (materials[i].HasProperty("_LightBalance"))
            {
                materials[i].SetFloat("_LightBalance", newSet._LightBalance);
            }
            if (materials[i].HasProperty("_Offset"))
            {
                materials[i].SetFloat("_Offset", newSet._Offset);
            }
            if (materials[i].HasProperty("_Scale"))
            {
                materials[i].SetFloat("_Scale", newSet._Scale);
            }
            if (materials[i].HasProperty("_Levels"))
            {
                materials[i].SetFloat("_Levels", newSet._Levels);
            }
            if (materials[i].HasProperty("_Brightness"))
            {
                materials[i].SetFloat("_Brightness", newSet._Brightness);
            }
            if (materials[i].HasProperty("_Contrast"))
            {
                materials[i].SetFloat("_Contrast", newSet._Contrast);
            }
            if (materials[i].HasProperty("_Shine"))
            {
                materials[i].SetFloat("_Shine", newSet._Shine);
            }

            RenderSettings.ambientLight = newSet.ambientLight;
        }
    }