示例#1
0
 private void Close()
 {
     mIsDropDownListVisible = false;
     currentHash            = "";
     lastComboBoxShow       = null;
     AONGUIBehaviour.AONGUI_ReDrawAll();
     // delayDontshow = 2;
 }
示例#2
0
    public override void Update()
    {
        base.Update();

        if (!m_isInitialized)
        {
            Init();
            return;
        }
        if (InputFieldHelper.Instance.IsShowNoti())
        {
            return;
        }

        bool isMouseLeft = Input.GetMouseButton(0);

        Vector3 vGuiMouse = new Vector2(Input.mousePosition.x, ScreenHeight() - Input.mousePosition.y);

        if (Input.GetMouseButtonDown(0))
        {
            if (m_rMinimapRect.Contains(vGuiMouse))
            {
                m_focus = true;
                // Debug.Log("ButtonDown");
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (m_focus)
            {
                m_focus = false;
                // Debug.Log("ButtonUp");
            }
        }

        // if(m_focus && m_rMinimapRect.Contains( vGuiMouse ))
        if (m_focus)
        {
            if (isMouseLeft)
            {
                float   minimapScale = m_rMinimapRect.width / m_autoTileMap.MinimapTexture.width;
                Vector3 vPos         = vGuiMouse - new Vector3(m_rMinimapRect.position.x, m_rMinimapRect.position.y);
                vPos.y  = -vPos.y;
                vPos.x *= m_autoTileMap.CellSize.x / minimapScale;
                vPos.y *= m_autoTileMap.CellSize.y / minimapScale;
                vPos.z  = m_camera2D.transform.position.z;
                m_camera2D.transform.position = vPos;
                AONGUIBehaviour.AONGUI_ReDrawAll();
            }
        }
        countMoveMap -= Time.deltaTime;
        if (countMoveMap > 0)
        {
            return;
        }
        countMoveMap = 0.05f;
        if (Input.GetKey(KeyCode.W))
        {
            if (!Input.GetKey(KeyCode.S))
            {
                var p = m_camera2D.transform.position;
                p.y += (m_autoTileMap.CellSize.y);
                m_camera2D.transform.position = p;
                AONGUIBehaviour.AONGUI_ReDrawAll();
            }
        }
        else if (Input.GetKey(KeyCode.S))
        {
            var p = m_camera2D.transform.position;
            p.y -= (m_autoTileMap.CellSize.y);
            m_camera2D.transform.position = p;
            AONGUIBehaviour.AONGUI_ReDrawAll();
        }
        if (Input.GetKey(KeyCode.A))
        {
            if (!Input.GetKey(KeyCode.D))
            {
                var p = m_camera2D.transform.position;
                p.x -= (m_autoTileMap.CellSize.x);
                m_camera2D.transform.position = p;
                AONGUIBehaviour.AONGUI_ReDrawAll();
            }
        }
        else if (Input.GetKey(KeyCode.D))
        {
            var p = m_camera2D.transform.position;
            p.x += (m_autoTileMap.CellSize.x);
            m_camera2D.transform.position = p;
            AONGUIBehaviour.AONGUI_ReDrawAll();
        }
    }
示例#3
0
    public static void DisOnGUI(Flags flagsYaml, ref float yGui, Rect rect, string[] lockKey = null, GUIStyle backgroundTop = null, string title = "Flag edit :", List <string> resetList = null)
    {
        if (backgroundTop != null)
        {
            float height_top = 68;
            AONGUI.Box(new Rect(rect.x, rect.y, rect.width, height_top), "", backgroundTop);
        }

        AONGUI.Label(new Rect(rect.x + 4, yGui + DefineAON.GUI_Y_Label, rect.width, DefineAON.GUI_Height_Label), title);
        yGui += 32f;

        if (flagsYaml == null)
        {
            return;
        }
        //Check key lock
        if (flagsYaml.CheckLockKey(lockKey))
        {
            AONGUIBehaviour.AONGUI_ReDrawAll();
            return;
        }
        var keys = flagsYaml.Keys;

        {
            //Add Key
            float xGui = rect.x + 4;
            AONGUI.Label(new Rect(xGui, yGui + DefineAON.GUI_Y_Label, 90, DefineAON.GUI_Height_Label), "Slug flag");
            xGui += 94;
            AONGUI.TextField(new Rect(xGui, yGui + DefineAON.GUI_Y_TextField, 200, DefineAON.GUI_Height_TextField), NameAdd, (string text) => {
                NameAdd = text;
            });
            xGui += 204;
            if (NameAdd.Length == 0)
            {
            }
            else
            {
                bool isUnique = true;
                foreach (string key in keys)
                {
                    if (key == NameAdd)
                    {
                        isUnique = false;
                        break;
                    }
                }
                if (isUnique)
                {
                    AONGUI.Button(new Rect(xGui, yGui + DefineAON.GUI_Y_Button, 40, DefineAON.GUI_Height_Button), "Add", () => {
                        flagsYaml.Add(NameAdd, 0);
                        NameAdd = "";
                        //Check clear cache comboBoxFlags
                        if (_instance != null && _instance.flagsCurrent == flagsYaml)
                        {
                            _instance.ResetCombobox();
                        }
                    });
                }
                else
                {
                    AONGUI.Label(new Rect(xGui, yGui + DefineAON.GUI_Y_Label, 200, DefineAON.GUI_Height_Label), "Slug should be unique");
                }
            }
            yGui += 32f;
        }
        yGui += 16f;
        int count = 0;

        foreach (string key in keys)
        {
            bool lockKeySub = false;
            if (lockKey != null && count < lockKey.Length)
            {
                lockKeySub = true;
            }
            if (key != "")
            {
                KeyValueOnGUI(flagsYaml, key, ref yGui, rect, lockKeySub, resetList, count);
            }
            count++;
        }
    }