Esempio n. 1
0
 void Update()
 {
     if (Program.I().deckManager != null)
     {
         if (loaded_code != code)
         {
             Texture2D t = GameTextureManager.get(code, GameTextureType.card_picture, defaults);
             if (t != null)
             {
                 uiTexture.mainTexture = t;
                 uiTexture.aspectRatio = ((float)t.width) / ((float)t.height);
                 uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio));
                 loaded_code    = code;
                 loaded_banlist = null;
             }
         }
         if (loaded_banlist != Program.I().deckManager.currentBanlist)
         {
             loaded_banlist = Program.I().deckManager.currentBanlist;
             if (ico != null)
             {
                 if (loaded_banlist == null)
                 {
                     ico.show(3);
                     return;
                 }
                 ico.show(loaded_banlist.GetQuantity(code));
             }
         }
     }
 }
 void Update()
 {
     if (loadedPicCode != cardData.Id)
     {
         Texture2D pic = GameTextureManager.get(cardData.Id, GameTextureType.card_picture);
         if (pic != null)
         {
             loadedPicCode = cardData.Id;
             gameObject.transform.FindChild("face").GetComponent <Renderer>().material.mainTexture = pic;
         }
     }
     if (Program.I().deckManager.currentBanlist != loaded_banlist)
     {
         ban_icon ico = GetComponentInChildren <ban_icon>();
         loaded_banlist = Program.I().deckManager.currentBanlist;
         if (loaded_banlist != null)
         {
             ico.show(loaded_banlist.GetQuantity(cardData.Id));
         }
         else
         {
             ico.show(3);
         }
     }
     if (isDraging)
     {
         gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f;
     }
     if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON)
     {
         killIt();
     }
 }
Esempio n. 3
0
    /// <summary>
    /// Texture used by the UITexture. You can set it directly, without the need to specify a material.
    /// </summary>
    ///

    protected override void OnStart()
    {
        base.OnStart();
        if (mOutPath != "")
        {
            mainTexture = GameTextureManager.get(mOutPath);
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Change the visual state.
    /// </summary>

    public override void SetState(State state, bool immediate)
    {
        base.SetState(state, immediate);

        if (mSprite != null)
        {
            switch (state)
            {
            case State.Normal: SetSprite(mNormalSprite); break;

            case State.Hover: SetSprite(string.IsNullOrEmpty(hoverSprite) ? mNormalSprite : hoverSprite); break;

            case State.Pressed: SetSprite(pressedSprite); break;

            case State.Disabled: SetSprite(disabledSprite); break;
            }
        }
        else if (mSprite2D != null)
        {
            switch (state)
            {
            case State.Normal: SetSprite(mNormalSprite2D); break;

            case State.Hover: SetSprite(hoverSprite2D == null ? mNormalSprite2D : hoverSprite2D); break;

            case State.Pressed: SetSprite(pressedSprite2D); break;

            case State.Disabled: SetSprite(disabledSprite2D); break;
            }
        }

        if (texure2d == null)
        {
            texure2d = GetComponentInChildren <UITexture>();
        }
        if (texure2d != null)
        {
            switch (state)
            {
            case State.Normal:
                if (mTextureOutNormal != "")
                {
                    texure2d.mainTexture = GameTextureManager.get(mTextureOutNormal);
                }
                break;

            case State.Hover:
            case State.Pressed:
                if (mTextureOutPressed != "")
                {
                    texure2d.mainTexture = GameTextureManager.get(mTextureOutPressed);
                }
                break;
            }
        }
    }
Esempio n. 5
0
 void Update()
 {
     if (coli != null)
     {
         if (Program.InputGetMouseButtonDown_0)
         {
             if (Program.pointedCollider == coli)
             {
                 ((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack, "", true);
             }
         }
     }
     if (Program.I().deckManager != null)
     {
         if (loaded_code != code)
         {
             Texture2D t = GameTextureManager.get(code, GameTextureType.card_picture, defaults);
             if (t != null)
             {
                 uiTexture.mainTexture = t;
                 uiTexture.aspectRatio = ((float)t.width) / ((float)t.height);
                 uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio));
                 loaded_code    = code;
                 loaded_banlist = null;
             }
         }
         if (loaded_banlist != Program.I().deckManager.currentBanlist)
         {
             loaded_banlist = Program.I().deckManager.currentBanlist;
             if (ico != null)
             {
                 if (loaded_banlist == null)
                 {
                     ico.show(3);
                     return;
                 }
                 ico.show(loaded_banlist.GetQuantity(code));
             }
             if (ico_ot != null)
             {
                 //[1: OCG]、[2: TCG]、[3: OCG&TCG]、[4: Anime]
                 if (data.Ot == 2 || data.Ot == 4)
                 {
                     ico_ot.show(data.Ot);
                     return;
                 }
                 ico_ot.show(3);
             }
         }
     }
 }
Esempio n. 6
0
    public void show(int i)
    {
        UITexture t = gameObject.GetComponent <UITexture>();

        if (t != null)
        {
            t.mainTexture = GameTextureManager.get("ban_" + i.ToString());
        }
        else
        {
            Renderer r = GetComponent <Renderer>();
            r.material.mainTexture = GameTextureManager.get("ban_" + i.ToString());
        }
    }
Esempio n. 7
0
 void Start()
 {
     pics[0] = GameTextureManager.get("jiandao");
     pics[1] = GameTextureManager.get("shitou");
     pics[2] = GameTextureManager.get("bu");
     texture_0.mainTexture           = pics[me];
     texture_1.mainTexture           = pics[op];
     GameObject_0.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
     iTweenExtensions.MoveToAction(GameObject_0, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f, () => {
         Destroy(GameObject_0, 0.3f);
     }, 0);
     GameObject_1.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
     iTweenExtensions.MoveToAction(GameObject_1, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f, () => {
         Destroy(GameObject_1, 0.3f);
     }, 0);
 }
Esempio n. 8
0
    public void show(int i)
    {
        UITexture t = gameObject.GetComponent <UITexture>();

        if (t != null)
        {
            if (i == 2 || i == 4)  //[1: OCG]、[2: TCG]、[3: OCG&TCG]、[4: Anime]
            {
                if (File.Exists("texture/ui/ban_ot_" + i.ToString() + ".png"))
                {
                    t.mainTexture = GameTextureManager.get("ban_ot_" + i.ToString());
                }
                else
                {
                    Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_" + i.ToString());
                    t.mainTexture = icon;
                }
            }
            else
            {
                Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_3");
                t.mainTexture = icon;
            }
        }
        else
        {
            Renderer r = GetComponent <Renderer>();
            if (i == 2 || i == 4)  //[1: OCG]、[2: TCG]、[3: OCG&TCG]、[4: Anime]
            {
                if (File.Exists("texture/ui/ban_ot_" + i.ToString() + ".png"))
                {
                    r.material.mainTexture = GameTextureManager.get("ban_ot_" + i.ToString());
                }
                else
                {
                    Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_" + i.ToString());
                    r.material.mainTexture = icon;
                }
            }
            else
            {
                Texture2D icon = (Texture2D)Resources.Load("ui/ban_ot_3");
                r.material.mainTexture = icon;
            }
        }
    }