UpdateColor() публичный Метод

Update the button's color to either enabled or disabled state.
public UpdateColor ( bool shouldBeEnabled, bool immediate ) : void
shouldBeEnabled bool
immediate bool
Результат void
Пример #1
0
    public IEnumerator Cooldown(float cooldown)
    {
        //Deactivate the Barrier button and update Color to Disable
        button.isEnabled = false;
        button.UpdateColor(true);
        slider.gameObject.SetActive(true);
        StartCoroutine(FillSlider(cooldown));
        currentCoolDown = cooldown;
        initialCooldown = cooldown;

        while (currentCoolDown > 0)
        {
            //Update Label with localized text each second
            label.text       = Localization.Get("Wait") + " " + Mathf.CeilToInt(currentCoolDown).ToString() + "s";
            currentCoolDown -= 1;
            //Wait for a second, then return to start of While
            yield return(new WaitForSeconds(1));
        }

        if (this != null && gameObject != null)
        {
            GetComponent <Collider2D>().enabled = false;
            yield return(null);
        }

        //If cooldown <= 0
        CooldownFinished();
        yield return(new WaitForSeconds(0.20f));

        if (this != null && gameObject != null)
        {
            GetComponent <Collider2D>().enabled = true;
            yield return(null);
        }
    }
Пример #2
0
//Create a room
    public void CreateRoom()
    {
        createRoomCreateButton.isEnabled = false;
        createRoomCreateButton.UpdateColor(true);
        NpgsqlCommand dbcmd;
        string        roomName = String.Empty;

        roomName = createRoomNameInput.value;
        string insertSQL = string.Format("INSERT INTO playerroom(roomcount, game_is_ready, host_pid, roomname) " +
                                         "VALUES('{0}', '{1}', '{2}', '{3}') ;",
                                         1, false, pid, roomName);

        dbcmd = new NpgsqlCommand(insertSQL, dbcon);
        dbcmd.ExecuteNonQuery();
        dbcmd.Dispose();

        updateCurrentRoomID();
        //StartCoroutine( updateCurrentRoomID ());
        Debug.Log("Created RoomID" + currentRoomID);
        //Insert player info to inroomstatus
        insertSQL = string.Format("INSERT INTO inroomstatus(pid, ign, roomid, turnid) " +
                                  "VALUES('{0}', '{1}', '{2}', '{3}') ;",
                                  pid, ign, currentRoomID, 0);
        dbcmd = new NpgsqlCommand(insertSQL, dbcon);
        dbcmd.ExecuteNonQuery();
        ShowCurrentGameRoomPanel();
        HideCreateRoomPanel();
        turnNum = 0;
        isHost  = true;
    }
 public override void Enable()
 {
     IsEnabled           = true;
     Button.defaultColor = _buttonOriginalDefaultColor;
     Button.hover        = _buttonOriginalHoverColor;
     Button.UpdateColor(IsEnabled, false);
 }
Пример #4
0
    public static void AvailableBtn(GameObject obj, GameObject target, string functionName)
    {
        if (obj == null)
        {
            return;
        }
        obj.SetActive(true);
        if (!target || string.IsNullOrEmpty(functionName))
        {
            return;
        }
        UIButton uiBtn = obj.GetComponent <UIButton>();

        if (uiBtn)
        {
            uiBtn.defaultColor = uiBtn.hover = Color.white;
            if (!uiBtn.isEnabled)
            {
                uiBtn.isEnabled = true;
            }
            else
            {
                uiBtn.UpdateColor(true);
            }
        }

        UIButtonMessage btnMsg = obj.GetComponent <UIButtonMessage>();

        btnMsg.target       = target;
        btnMsg.functionName = functionName;
    }
Пример #5
0
 public void SetButtonColor(bool is_enable_button, bool is_instant)
 {
     //IL_0012: Unknown result type (might be due to invalid IL or missing references)
     //IL_0017: Unknown result type (might be due to invalid IL or missing references)
     //IL_0018: Unknown result type (might be due to invalid IL or missing references)
     //IL_0019: Unknown result type (might be due to invalid IL or missing references)
     //IL_001e: Unknown result type (might be due to invalid IL or missing references)
     //IL_002a: Unknown result type (might be due to invalid IL or missing references)
     //IL_002f: Unknown result type (might be due to invalid IL or missing references)
     //IL_003a: Unknown result type (might be due to invalid IL or missing references)
     //IL_003f: Unknown result type (might be due to invalid IL or missing references)
     //IL_0055: Unknown result type (might be due to invalid IL or missing references)
     //IL_005a: Unknown result type (might be due to invalid IL or missing references)
     //IL_005b: Unknown result type (might be due to invalid IL or missing references)
     //IL_005c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0061: Unknown result type (might be due to invalid IL or missing references)
     //IL_006d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0072: Unknown result type (might be due to invalid IL or missing references)
     //IL_007d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0082: Unknown result type (might be due to invalid IL or missing references)
     if (is_enable_button)
     {
         button.defaultColor  = (button.hover = Color.get_white());
         button.pressed       = Color.get_white();
         button.disabledColor = Color.get_white();
     }
     else
     {
         button.defaultColor  = (button.hover = Color.get_gray());
         button.pressed       = Color.get_gray();
         button.disabledColor = Color.get_gray();
     }
     button.UpdateColor(is_instant);
 }
 public IEnumerator Cooldown(int cooldown)
 {
     // 장애물 버튼을 비활성화하고 그에 맞게 버튼 색상을 갱신한다
     button.isEnabled = false;
     button.UpdateColor(false);
     while (cooldown > 0)
     {
         // 매 초, 지역화된 문자열로 레이블을 갱신한다
         label.text = Localization.Get("Wait") + " " + cooldown.ToString() + "s";
         cooldown  -= 1;
         // 1초동안 기다렸다가 while문의 첫 부분으로 돌아간다
         yield return(new WaitForSeconds(1));
     }
     // 대기 시간이 0보다 작으면
     CooldownFinished();
 }
Пример #7
0
//Ask Nick:
    //How does name change work
    //How to join room: double click the room? Or select and then press join button. How does it recognize the click of the room
    //My guess: make the tiles buttons. On click retrieve the value of room number

//Join an open room
//Room ID, IGNs,
    public void JoinRoom(int roomid)
    {
        startGameButton.isEnabled = false;
        startGameButton.UpdateColor(true);
        setCurrentRoomID(roomid);
        NpgsqlCommand dbcmd;
        string        selectSQL = string.Format("SELECT roomcount FROM playerroom WHERE roomid = '{0}';", currentRoomID);

        dbcmd = new NpgsqlCommand(selectSQL, dbcon);
        NpgsqlDataReader reader = dbcmd.ExecuteReader();

        if (reader.HasRows)
        {
            if (reader.Read())
            {
                turnNum = ((int)reader ["roomcount"]);
                Debug.Log("turnNum" + turnNum);
            }
        }
        reader.Close();
        reader = null;
        dbcmd.Dispose();
        string insertSQL = string.Format("INSERT INTO inroomstatus(pid, ign, roomid, turnid) " +
                                         "VALUES('{0}', '{1}', '{2}', '{3}') ;",
                                         pid, ign, currentRoomID, turnNum);

        dbcmd = new NpgsqlCommand(insertSQL, dbcon);
        dbcmd.ExecuteNonQuery();
        dbcmd.Dispose();

        string updateSQL = string.Format("UPDATE playerroom SET roomcount = roomcount+1 WHERE roomid = '{0}';", currentRoomID);

        dbcmd = new NpgsqlCommand(updateSQL, dbcon);


        //dbcmd = new NpgsqlCommand (insertSQL, dbcon);
        dbcmd.ExecuteNonQuery();
        dbcmd.Dispose();
        startGameController.setTurnID(turnNum);
        startGameController.setRoomID(currentRoomID);
        startGameController.setPID(pid);
        //Insert into inroom status
        HideLobbyPanel();
        ShowCurrentGameRoomPanel();
    }
Пример #8
0
    public void SetState()
    {
        UIButton btn = GetComponent <UIButton>();

        if (null != btn)
        {
            btn.UpdateColor(true, true);
        }
    }
Пример #9
0
 void Update()
 {
     if (_talentTree.checkPreRequisites(skillId) == true && _uiButton.defaultColor != _enabledColor)
     {
         _uiButton.defaultColor = _enabledColor;
         _uiButton.UpdateColor(true, true);
     }
     else if (_talentTree.checkPreRequisites(skillId) == false && _uiButton.defaultColor != _disabledColor)
     {
         _uiButton.defaultColor = _disabledColor;
         _uiButton.UpdateColor(true, true);
     }
     if (_talentTree.isLearnt(skillId) == true && _checkMark.depth != 10)
     {
         _checkMark.depth = 10;
     }
     else if (_talentTree.isLearnt(skillId) == false && _checkMark.depth != _originalDepth)
     {
         _checkMark.depth = _originalDepth;
     }
 }
    public override void UpdateUI()
    {
        SetLabelText((Enum)UI.LBL_ITEM_TEXT, itemString);
        if (starValue == 0)
        {
            MonoBehaviourSingleton <UIAnnounceBand> .I.SetAnnounce("Received: " + itemString, string.Empty);

            SetEnableYesButton(false);
            yesButton.UpdateColor(true);
        }
        base.UpdateUI();
    }
Пример #11
0
    // Use this for initialization
    void Start()
    {
        timer          = 0;
        isHost         = false;
        pid            = -1;
        currentRoomID  = -1;
        turnNum        = 0;
        numPlayers     = -1;
        keepRefreshing = true;

        float heightContainerScaler = (float)(Screen.height + 4) / (float)loginTexture.height;

        loginContainer.transform.localScale       = new Vector3(heightContainerScaler, heightContainerScaler, 1f);
        lobbyContainer.transform.localScale       = new Vector3(heightContainerScaler, heightContainerScaler, 1f);
        registerContainer.transform.localScale    = new Vector3(heightContainerScaler, heightContainerScaler, 1f);
        prelobbyContainer.transform.localScale    = new Vector3(heightContainerScaler, heightContainerScaler, 1f);
        currentRoomContainer.transform.localScale = new Vector3(heightContainerScaler, heightContainerScaler, 1f);
        createRoomContainer.transform.localScale  = new Vector3(heightContainerScaler, heightContainerScaler, 1f);

        joinRoomButton.isEnabled = false;
        joinRoomButton.UpdateColor(true);
        createRoomButton.isEnabled = false;
        createRoomButton.UpdateColor(true);
        createRoomCreateButton.isEnabled = false;
        createRoomButton.UpdateColor(true);
//Database Connection===================================================================================================================================
        string connectionString =
            "Server= pdc-amd01.poly.edu;" +
            "Database=kl1983;" +
            "User ID=kl1983;" +
            "Password=z86udpx%;";

        dbcon = new NpgsqlConnection(connectionString);
        dbcon.Open();
        Debug.Log("Connected");
        NpgsqlCommand dbcmd = dbcon.CreateCommand();
    }
Пример #12
0
 public void InitPunto(int i, Ruta r)
 {
     ruta             = r;
     indicePunto      = i;
     puntoVisitado    = PlayerPrefs.GetInt("visitadoPunto" + indicePunto) == 1;
     expPunto         = (tipo == Tipo.Principal ? ruta.expPrincipal : ruta.expSecundario);
     btn.defaultColor = r.color;
     btn.UpdateColor(true);
     tweenColor.from = btn.defaultColor;
     tweenColor.to   = btn.pressed;
     tweenColor.ResetToBeginning();
     if (puntoVisitado)
     {
         PuntoVisitado();
     }
 }
Пример #13
0
        void Start()
        {
            BtnGarden.UpdateColor(true, true);
            BtnSkill.UpdateColor(true, true);
            BtnRealTimeFighting.UpdateColor(true, true);
            BtnAdventure.UpdateColor(true, true);

            if (!_hasRefreshed)
            {
                RefreshMyInfo();                //确保加载完成后一定会刷新至少一次
            }
            if (HighlightAdventureBtn)
            {
                BtnAdventure.GetComponent <Animator>().enabled = true;
                HighlightAdventureBtn = false;
            }
            else
            {
                BtnAdventure.GetComponent <Animator>().enabled = false;
            }
        }
Пример #14
0
    public void SetShowOption(bool is_enable)
    {
        //IL_0044: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
        //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
        //IL_0140: Unknown result type (might be due to invalid IL or missing references)
        int num = (lbls != null) ? lbls.Length : 0;

        if (is_enable)
        {
            int i = 0;
            for (int num2 = num; i < num2; i++)
            {
                if (lbls[i] != null)
                {
                    lbls[i].color = Color.get_white();
                }
            }
            btn.GetComponent <BoxCollider>().set_enabled(true);
            btn.normalSprite = (btn.pressedSprite = buttonSpriteName[0]);
            spr.spriteName   = frameSpriteName[0];
            tex.color        = texEnableColor;
        }
        else
        {
            int j = 0;
            for (int num3 = num; j < num3; j++)
            {
                if (lbls[j] != null)
                {
                    lbls[j].color = disableColor;
                }
            }
            btn.GetComponent <BoxCollider>().set_enabled(false);
            btn.normalSprite = (btn.pressedSprite = buttonSpriteName[1]);
            spr.spriteName   = frameSpriteName[1];
            tex.color        = disableColor;
        }
        btn.UpdateColor(true);
    }
Пример #15
0
 public void setEnableBtn(bool isEnable)
 {
     btnJump.UpdateColor(isEnable);
 }
Пример #16
0
 public static void UpdateColor(this UIButton nativeButton, IButton button, Color defaultColor) =>
 nativeButton.UpdateColor(button.Color, defaultColor);
Пример #17
0
 public static void UpdateColor(this UIButton nativeButton, IButton button) =>
 nativeButton.UpdateColor(button.Color, nativeButton.TitleColor(UIControlState.Normal).ToColor());