Esempio n. 1
0
    public void RingGray()
    {
        //UnityNativeChromaSDK.PlayAnimationName("Blank_Keyboard.chroma");

        baseLayer = "RingGray_Keyboard.chroma";
        UnityNativeChromaSDK.CloseAnimationName(baseLayer);
        UnityNativeChromaSDK.MultiplyIntensityAllFramesName(baseLayer, 1.0f + 64.0f * _mBaseIntensity);

        List <int> keyList = new List <int>();

        if (w)
        {
            keyList.Add((int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_W);
        }
        if (a)
        {
            keyList.Add((int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_A);
        }
        if (s)
        {
            keyList.Add((int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_S);
        }
        if (d)
        {
            keyList.Add((int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_D);
        }

        int[] keys = keyList.ToArray();

        Color color = new Color(_mHotkeyIntensity * 1, _mHotkeyIntensity * 0.5f, 0);

        UnityNativeChromaSDK.SetKeysColorAllFramesName(baseLayer, keys, color);

        UnityNativeChromaSDK.PlayAnimationName(baseLayer, true);
    }
Esempio n. 2
0
    private void ClickHeal()
    {
        int[] keys = new int[]
        {
            (int)UnityNativeChromaSDK.Keyboard.RZLED.RZLED_LOGO,
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_ESC,
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_Q,
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_E
        };

        string baseLayer = "EnvironmentSnow_Keyboard.chroma";

        UnityNativeChromaSDK.CloseAnimationName(baseLayer);
        UnityNativeChromaSDK.MultiplyIntensityAllFramesName(baseLayer, 1.0f + 64.0f * _mBaseIntensity);

        string layer2 = "RingGray_Keyboard.chroma";

        UnityNativeChromaSDK.CloseAnimationName(layer2);
        // turn animation green
        UnityNativeChromaSDK.OffsetNonZeroColorsAllFramesName(layer2, -127, 127, -127); //animation starts with 127,127,127 so adding -127,127,-127 results in 0,255,0 or green
        // set intensity
        UnityNativeChromaSDK.MultiplyIntensityAllFramesName(layer2, _mEffectIntensity);
        UnityNativeChromaSDK.CopyNonZeroAllKeysAllFramesName(layer2, baseLayer);

        string layer3 = "FadeInOutGray_Keyboard.chroma";

        UnityNativeChromaSDK.CloseAnimationName(layer3);
        // change color
        UnityNativeChromaSDK.OffsetNonZeroColorsAllFramesName(layer3, 173 - 127, 255 - 127, 47 - 127);
        // set intensity
        UnityNativeChromaSDK.MultiplyIntensityAllFramesName(layer3, _mHotkeyIntensity);
        UnityNativeChromaSDK.CopyKeysColorAllFramesName(layer3, baseLayer, keys);

        keys = new int[]
        {
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_W,
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_A,
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_S,
            (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_D
        };

        Color color = new Color(_mHotkeyIntensity * 1, _mHotkeyIntensity * 0.5f, 0);

        UnityNativeChromaSDK.SetKeysColorAllFramesName(baseLayer, keys, color);

        UnityNativeChromaSDK.PlayAnimationName(baseLayer, true);
    }
    private void OnGUI()
    {
        if (!UnityNativeChromaSDK.IsPlatformSupported())
        {
            GUILayout.BeginVertical(GUILayout.Height(Screen.height));
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(GUILayout.Width(Screen.width));
            GUILayout.FlexibleSpace();
            GUILayout.Label("The ChromaSDK is not supported on this platform!");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            return;
        }

        GUI.enabled = UnityNativeChromaSDK.PluginIsInitialized();

        GUILayout.BeginVertical(GUILayout.Height(Screen.height));
        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal(GUILayout.Width(Screen.width));
        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Show Hotkeys", GUILayout.Height(60)))
        {
            UnityNativeChromaSDK.CloseAnimationName(TARGET_ANIMATION);

            // copy colors from another animation
            UnityNativeChromaSDK.CopyKeysColorAllFramesName(SOURCE_ANIMATION, TARGET_ANIMATION,
                                                            new int[] {
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_W,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_A,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_S,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_D,
                (int)UnityNativeChromaSDK.Keyboard.RZLED.RZLED_LOGO
            });

            // set static colors
            UnityNativeChromaSDK.SetKeysColorAllFramesName(TARGET_ANIMATION,
                                                           new int[] {
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_I,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_J,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_K,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_L,
                (int)UnityNativeChromaSDK.Keyboard.RZKEY.RZKEY_ENTER
            },
                                                           Color.red);

            UnityNativeChromaSDK.PlayAnimationName(TARGET_ANIMATION, true);
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Hide Hotkeys", GUILayout.Height(60)))
        {
            UnityNativeChromaSDK.CloseAnimationName(TARGET_ANIMATION);
            UnityNativeChromaSDK.PlayAnimationName(TARGET_ANIMATION, true);
        }

        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();

        GUI.enabled = true;
    }