Пример #1
0
    public void SetBrushMode(int newMode)
    {
        Painter_BrushMode brushMode = newMode == 0? Painter_BrushMode.DECAL:Painter_BrushMode.PAINT;      //Cant set enums for buttons :(
        string            colorText = brushMode == Painter_BrushMode.PAINT?"orange":"purple";

        guiTextMode.text = "<b>Mode:</b><color=" + colorText + ">" + brushMode.ToString() + "</color>";
    }
Пример #2
0
    ////////////////// PUBLIC METHODS //////////////////

    public void SetBrushMode(Painter_BrushMode brushMode)      //Sets if we are painting or placing decals
    {
        mode = brushMode;
        //TODO change to children
        var srs = brushCursor.GetComponentsInChildren <SpriteRenderer>();

        for (int i = 0; i < srs.Length; ++i)
        {
            srs[i].sprite = brushMode == Painter_BrushMode.PAINT ? cursorPaint : cursorDecal;
        }
    }
Пример #3
0
 private void InitBrushes()
 {
     foreach (Transform transBtn in transPanelBrush)
     {
         Button btnBrush = transBtn.GetComponent <Button>();
         btnBrush.onClick.AddListener(() => {
             Image imgBrush         = transBtn.GetComponent <Image>();
             string strSprite       = imgBrush.sprite.name;
             Painter_BrushMode mode = GetBrushMode(strSprite);
             painter.SetBrushMode(mode, strSprite);
             transPanelBrush.gameObject.SetActive(false);
         });
     }
 }
Пример #4
0
    //FIXME:重写方法 增加参数:sprite名称
    public void SetBrushMode(Painter_BrushMode brushMode, string strSprite)
    {
        mode = brushMode;
        if (!myAtlas)
        {
            myAtlas = Resources.Load <SpriteAtlas>("MyAtlas");
        }
        if (!myAtlas)
        {
            Debug.Log("my atlas is null");
            return;
        }
        Sprite sprite = myAtlas.GetSprite(strSprite);

        brushCursor.GetComponent <SpriteRenderer>().sprite = sprite;
    }
Пример #5
0
    ////////////////// PUBLIC METHODS //////////////////

    public void SetBrushMode(Painter_BrushMode brushMode)      //Sets if we are painting or placing decals
    {
        mode = brushMode;
        brushCursor.GetComponent <SpriteRenderer> ().sprite = brushMode == Painter_BrushMode.PAINT ? cursorPaint : cursorDecal;
    }
Пример #6
0
        ////////////////// PUBLIC METHODS //////////////////

        public void SetBrushMode(Painter_BrushMode brushMode)          //Sets if we are painting or placing decals
        {
            mode = brushMode;
        }
Пример #7
0
	////////////////// PUBLIC METHODS //////////////////

	public void SetBrushMode(Painter_BrushMode brushMode){ //Sets if we are painting or placing decals
		mode = brushMode;
		brushCursor.GetComponent<SpriteRenderer> ().sprite = brushMode == Painter_BrushMode.PAINT ? cursorPaint : cursorDecal;
	}