예제 #1
0
    public override void OnTaskGUI()
    {
        base.OnTaskGUI();
        // TODO(dm): Refactor.

        bool preview = Time.time >= _timeOpened && Time.time <= _timeOpened + 1f;
        bool error   = Time.time < _timeOpened;

        GUI.Box(new Rect(Screen.width / 2f - 256f, Screen.height / 2f - 256f, 512f, 512f), "");
        for (int i = 0; i < 5; ++i)
        {
            for (int j = 0; j < 5; ++j)
            {
                float     x      = Screen.width / 2f - 256f + 8f + j * 99f;
                float     y      = Screen.height / 2f - 256f + 8f + i * 99f;
                int       index  = i * 5 + j;
                bool      ticked = preview && ((TickedButtons >> index) & 0b1) == 1 || ((_tickedButtons >> index) & 0b1) == 1;
                Texture2D tex    = error ? _unTickedBackground : ticked ? _tickedBackground : _regularBackground;
                GUITaskUtils.SetBackground(tex);
                if (GUI.Button(new Rect(x, y, 90f, 90f), ""))
                {
                    if (!preview && !error)
                    {
                        _tickedButtons |= 1 << index;
                        SendTaskStep(_tickedButtons);
                    }
                }
            }
        }

        GUITaskUtils.SetBackground(null);
    }
예제 #2
0
    public override void OnTaskGUI()
    {
        base.OnTaskGUI();
        // TODO(dm): Refactor.

        GUI.Box(new Rect(Screen.width / 2f - 256f, Screen.height / 2f - 64f, 512f, 128f), "");
        for (int i = 0; i < 8; ++i)
        {
            int       state = ((_buttons >> i) & 0b1) == 1 ? 1 : 0;
            Texture2D tex   = state == 0 ? _unTickedBackground : _tickedBackground;
            GUITaskUtils.SetBackground(tex);
            if (GUI.Button(new Rect(Screen.width / 2f - 248f + i * 64f, Screen.height / 2f - 56f, 48f, 112f), ""))
            {
                if (state == 1)
                {
                    _buttons ^= (byte)(0b1 << i);
                }
                else
                {
                    _buttons |= (byte)(0b1 << i);
                }
            }
        }

        if (Player.GetLocal.IsHunter && _buttons == 0b11111111 || !Player.GetLocal.IsHunter && _buttons == 0)
        {
            Player.GetLocal.CmdTaskFinish(null);
            SendTaskFinish();
            OnTaskFinishClient();
        }

        GUITaskUtils.SetBackground(null);
    }
예제 #3
0
    public override void OnTaskGUI()
    {
        base.OnTaskGUI();
        // TODO(dm): Refactor.

        GUI.Box(new Rect(Screen.width / 2f - 256f, Screen.height / 2f - 64f, 512f, 128f), "");
        int size = Controlling.Length;

        for (int i = 0; i < size; ++i)
        {
            int       state = ((_doors >> i) & 0b1) == 1 ? 1 : 0;
            Texture2D tex   = state == 0 ? _unTickedBackground : _tickedBackground;
            GUITaskUtils.SetBackground(tex);
            if (GUI.Button(new Rect(Screen.width / 2f - (size / 2f * 64f) + i * 64f, Screen.height / 2f - 56f, 48f, 112f), ""))
            {
                if (state == 1)
                {
                    _doors ^= (byte)(0b1 << i);
                }
                else
                {
                    _doors |= (byte)(0b1 << i);
                }

                SendTaskStep(_doors);
            }
        }

        // if (Player.GetLocal.IsHunter && _buttons == 0b11111111 || !Player.GetLocal.IsHunter && _buttons == 0) {
        //     Player.GetLocal.CmdTaskFinish(null);
        //     OnTaskFinishClient();
        // }

        GUITaskUtils.SetBackground(null);
    }
예제 #4
0
    public override void OnTaskGUI()
    {
        base.OnTaskGUI();

        GUI.BeginGroup(new Rect(Screen.width / 2f - 306f, Screen.height / 2f - 256f, 612f, 512f));

        for (int i = 0; i < 5; ++i)
        {
            for (int j = 0; j < 6; ++j)
            {
                float x     = 8f + j * 99f;
                float y     = 8f + i * 99f;
                int   index = i * 6 + j;
                int   num   = _numbers.FindIndex(b => b == (byte)index);
                if (num == -1)
                {
                    continue;
                }
                Texture2D tex   = _error ? _unTickedBackground : num >= _nextIndex ? _regularBackground : _tickedBackground;
                Color     color = num >= _nextIndex && !_error ? Color.black : Color.white;
                GUITaskUtils.SetBackground(tex);
                GUI.contentColor = color;
                if (GUI.Button(new Rect(x, y, 90f, 90f), _isTutorial || _nextIndex == 0 ? (num + 1).ToString() : ""))
                {
                    if (!_error)
                    {
                        if (_nextIndex == num)
                        {
                            _nextIndex++;
                        }
                        else
                        {
                            _error = true;
                            StartCoroutine(ResetError(1.5f));
                        }
                    }
                }
            }
        }

        GUI.contentColor = Color.black;
        GUITaskUtils.SetBackground(null);

        GUI.EndGroup();
    }
예제 #5
0
    public override void OnTaskGUI()
    {
        base.OnTaskGUI();
        GUI.BeginGroup(new Rect(Screen.width / 2f - 184f, Screen.height / 2f - 74f, 368f, 148f));
        GUI.Box(new Rect(0f, 0f, 368f, 148f), "");
        for (int i = 0; i < 2; ++i)
        {
            for (int j = 0; j < 5; ++j)
            {
                float     x     = 8f + j * 72f;
                float     y     = 8f + i * 72f;
                int       index = i * 5 + j;
                Texture2D tex   = _error ? _unTickedBackground : _index > _positions[index] ? _tickedBackground : _regularBackground;
                GUITaskUtils.SetBackground(tex);
                GUI.contentColor = tex == _tickedBackground ? Color.white : Color.black;
                if (GUI.Button(new Rect(x, y, 64f, 64f), (_positions[index] + 1).ToString()))
                {
                    if (!_error)
                    {
                        if (_positions[index] == _index)
                        {
                            _index++;
                            if (_index == 10)
                            {
                                SendTaskFinish();
                            }
                        }
                        else
                        {
                            _error = true;
                            StartCoroutine(ResetError());
                        }
                    }
                }
            }
        }

        GUI.contentColor = Color.black;
        GUITaskUtils.SetBackground(null);

        GUI.EndGroup();
    }
예제 #6
0
    public override void OnTaskGUI()
    {
        base.OnTaskGUI();
        // TODO(dm): Refactor.

        GUI.Box(new Rect(Screen.width / 2f - 256f, Screen.height / 2f - 256f, 512f, 512f), "");
        for (int i = 0; i < 4; ++i)
        {
            for (int j = 0; j < 2; ++j)
            {
                int pos   = i * 2 + j;
                int state = ((_buttons >> pos) & 0b1) == 1                          ? 1 :
                            ((Buttons >> pos) & 0b1) == 1 && ((_buttons >> pos) & 0b1) == 0 ? 2 : 0;
                Texture2D tex = state == 0 ? _regularBackground : state == 1 ? _tickedBackground : _unTickedBackground;
                GUITaskUtils.SetBackground(tex);
                if (GUI.Button(new Rect(Screen.width / 2f - 248f + j * 256f, Screen.height / 2f - 248f + i * 128f, 240f, 112f), ""))
                {
                    if (state == 1)
                    {
                        _buttons ^= (byte)(0b1 << pos);
                    }
                    else
                    {
                        _buttons |= (byte)(0b1 << pos);
                    }
                }
            }
        }

        if (Buttons == _buttons && Buttons != 0)
        {
            SendTaskFinish();
        }

        GUITaskUtils.SetBackground(null);
    }