private void apply(YGOSharp.Card card, Texture2D def, string tail)
    {
        if (card == null)
        {
            return;
        }
        string smallstr = "";

        if (card.Id != 0)
        {
            smallstr  = GameStringHelper.getName(card) + GameStringHelper.getSmall(card);
            smallstr += "\n";
        }
        if (tail == "")
        {
            description.Clear();
            description.Add(smallstr + card.Desc);
        }
        else
        {
            description.Clear();
            description.Add(smallstr + "[FFD700]" + tail + "[-]" + card.Desc);
        }
        picLoader.code        = card.Id;
        picLoader.defaults    = def;
        picLoader.loaded_code = -1;
        currentCard           = card;
        shiftCardShower(true);
        Program.go(50, () => { shiftCardShower(true); });
    }
 public void setData(YGOSharp.Card card, Texture2D def, string tail = "", bool force = false)
 {
     if (cardShowerWidget.alpha == 0 && force == false)
     {
         return;
     }
     if (card == null)
     {
         return;
     }
     if (card.Id == 0)
     {
         apply(card, def, tail);
         return;
     }
     if (datas.Count > 0)
     {
         if (datas[datas.Count - 1].card.Id == card.Id)
         {
             datas[datas.Count - 1] = new data
             {
                 card = card,
                 def  = def,
                 tail = tail
             };
             if (datas.Count > 300)
             {
                 datas.RemoveAt(0);
             }
             current = datas.Count - 1;
             loadData();
             return;
         }
     }
     datas.Add(new data
     {
         card = card,
         def  = def,
         tail = tail
     });
     if (datas.Count > 300)
     {
         datas.RemoveAt(0);
     }
     current = datas.Count - 1;
     loadData();
 }
Exemple #3
0
    public static string getName(YGOSharp.Card card)
    {
        string re = "";

        try
        {
            re += "[b]" + card.Name + "[/b]";
            re += "\n";
            re += "[sup]" + card.Id.ToString() + "[/sup]";
            re += "\n";
        }
        catch (Exception e)
        {
        }

        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_EARTH))
        {
            re = "[F4A460]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_WATER))
        {
            re = "[D1EEEE]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_FIRE))
        {
            re = "[F08080]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_WIND))
        {
            re = "[B3EE3A]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_LIGHT))
        {
            re = "[EEEE00]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_DARK))
        {
            re = "[FF00FF]" + re + "[-]";
        }

        return(re);
    }
Exemple #4
0
 Percy.CardData cardHandler(long code)
 {
     YGOSharp.Card card = YGOSharp.CardsManager.GetCard((int)code);
     if (card == null)
     {
         card = new YGOSharp.Card();
     }
     Percy.CardData retuvalue = new Percy.CardData();
     retuvalue.Alias     = card.Alias;
     retuvalue.Attack    = card.Attack;
     retuvalue.Attribute = card.Attribute;
     retuvalue.Code      = card.Id;
     retuvalue.Defense   = card.Defense;
     retuvalue.Level     = card.Level;
     retuvalue.LScale    = card.LScale;
     retuvalue.Race      = card.Race;
     retuvalue.RScale    = card.RScale;
     retuvalue.Setcode   = card.Setcode;
     retuvalue.Type      = card.Type;
     return(retuvalue);
 }
Exemple #5
0
    public static string LinkMarker(YGOSharp.Card data)
    {
        string LinkMarker = "\n" + GameStringManager.get_unsafe(1374) + ":";

        if (data.HasLinkMarker(CardLinkMarker.TopLeft))
        {
            LinkMarker += " [\u2196]";  //↖
        }
        if (data.HasLinkMarker(CardLinkMarker.Top))
        {
            LinkMarker += " [\u2191]";  //↑
        }
        if (data.HasLinkMarker(CardLinkMarker.TopRight))
        {
            LinkMarker += " [\u2197]";  //↗
        }
        if (data.HasLinkMarker(CardLinkMarker.Left))
        {
            LinkMarker += " [\u2190]";  //←
        }
        if (data.HasLinkMarker(CardLinkMarker.Right))
        {
            LinkMarker += " [\u2192]";  //→
        }
        if (data.HasLinkMarker(CardLinkMarker.BottomLeft))
        {
            LinkMarker += " [\u2199]";  //↙
        }
        if (data.HasLinkMarker(CardLinkMarker.Bottom))
        {
            LinkMarker += " [\u2193]";  //↓
        }
        if (data.HasLinkMarker(CardLinkMarker.BottomRight))
        {
            LinkMarker += " [\u2198]";  //↘
        }
        return(LinkMarker);
    }
Exemple #6
0
    public static string getSmall(YGOSharp.Card data)
    {
        string re = "";

        try
        {
            if ((data.Type & 0x1) > 0)
            {
                re += "[ff8000]";
                re += "[" + secondType(data.Type) + "]";

                if ((data.Type & (int)CardType.Link) == 0)
                {
                    if ((data.Type & (int)CardType.Xyz) > 0)
                    {
                        re += " " + race(data.Race) + fen + attribute(data.Attribute) + fen + data.Level.ToString() + "[sup]☆[/sup]";
                    }
                    else
                    {
                        re += " " + race(data.Race) + fen + attribute(data.Attribute) + fen + data.Level.ToString() + "[sup]★[/sup]";
                    }
                }
                else
                {
                    re += " " + race(data.Race) + fen + attribute(data.Attribute);
                }

                if (data.LScale > 0)
                {
                    re += fen + data.LScale.ToString() + "[sup]P[/sup]";
                }
                re += "\n";
                if (data.Attack < 0)
                {
                    re += "[sup]ATK[/sup]?  ";
                }
                else
                {
                    if (data.rAttack > 0)
                    {
                        int pos = data.Attack - data.rAttack;
                        if (pos > 0)
                        {
                            re += "[sup]ATK[/sup]" + data.Attack.ToString() + "(↑" + pos.ToString() + ")  ";
                        }
                        if (pos < 0)
                        {
                            re += "[sup]ATK[/sup]" + data.Attack.ToString() + "(↓" + (-pos).ToString() + ")  ";
                        }
                        if (pos == 0)
                        {
                            re += "[sup]ATK[/sup]" + data.Attack.ToString() + "  ";
                        }
                    }
                    else
                    {
                        re += "[sup]ATK[/sup]" + data.Attack.ToString() + "  ";
                    }
                }
                if ((data.Type & (int)CardType.Link) == 0)
                {
                    if (data.Defense < 0)
                    {
                        re += "[sup]DEF[/sup]?";
                    }
                    else
                    {
                        if (data.rAttack > 0)
                        {
                            int pos = data.Defense - data.rDefense;
                            if (pos > 0)
                            {
                                re += "[sup]DEF[/sup]" + data.Defense.ToString() + "(↑" + pos.ToString() + ")";
                            }
                            if (pos < 0)
                            {
                                re += "[sup]DEF[/sup]" + data.Defense.ToString() + "(↓" + (-pos).ToString() + ")";
                            }
                            if (pos == 0)
                            {
                                re += "[sup]DEF[/sup]" + data.Defense.ToString();
                            }
                        }
                        else
                        {
                            re += "[sup]DEF[/sup]" + data.Defense.ToString();
                        }
                    }
                }
                else
                {
                    re += "[sup]LINK[/sup]" + data.Level.ToString();
                }
            }
            else if ((data.Type & 0x2) > 0)
            {
                re += "[7FFF00]";
                re += secondType(data.Type);
                if (data.LScale > 0)
                {
                    re += fen + data.LScale.ToString() + "[sup]P[/sup]";
                }
            }
            else if ((data.Type & 0x4) > 0)
            {
                re += "[dda0dd]";
                re += secondType(data.Type);
            }
            else
            {
                re += "[ff8000]";
            }
            if (data.Alias > 0)
            {
                if (data.Alias != data.Id)
                {
                    string name = YGOSharp.CardsManager.Get(data.Alias).Name;
                    if (name != data.Name)
                    {
                        re += "\n[" + YGOSharp.CardsManager.Get(data.Alias).Name + "]";
                    }
                }
            }
            if (data.Setcode > 0)
            {
                re += "\n";
                re += xilie;
                re += getSetName(data.Setcode);
            }
            re += "[-]";
        }
        catch (Exception e)
        {
        }
        return(re);
    }
Exemple #7
0
    public static string getName(YGOSharp.Card card)
    {
        string limitot = "";

        switch (card.Ot)
        {
        case 1:
            limitot = "[OCG] ";
            break;

        case 2:
            limitot = "[TCG] ";
            break;

        case 3:
            limitot = "[OCG/TCG] ";
            break;

        case 4:
            limitot = "[Anime] ";
            break;
        }
        string re = "";

        try
        {
            re += "[b]" + card.Name + "[/b]";
            re += "\n";
            re += "[sup]" + limitot + "[/sup]";
            re += "\n";
            re += "[sup]" + card.Id.ToString() + "[/sup]";
            re += "\n";
        }
        catch (Exception e)
        {
        }

        if (differ(card.Attribute, (int)CardAttribute.Earth))
        {
            re = "[F4A460]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Water))
        {
            re = "[D1EEEE]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Fire))
        {
            re = "[F08080]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Wind))
        {
            re = "[B3EE3A]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Light))
        {
            re = "[EEEE00]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Dark))
        {
            re = "[FF00FF]" + re + "[-]";
        }

        return(re);
    }
    void excite()
    {
        excited = true;
        if (location == CardLocation.Grave && Program.I().ocgcore.cantCheckGrave)
        {
            return;
        }
        YGOSharp.Card data       = null;
        string        tailString = "";
        uint          con        = 0;

        for (int i = 0; i < Program.I().ocgcore.cards.Count; i++)
        {
            if (Program.I().ocgcore.cards[i].gameObject.activeInHierarchy)
            {
                if ((Program.I().ocgcore.cards[i].p.location & (UInt32)location) > 0)
                {
                    if (Program.I().ocgcore.cards[i].p.controller == player)
                    {
                        if (Program.I().ocgcore.cards[i].isShowed == false)
                        {
                            data       = Program.I().ocgcore.cards[i].get_data();
                            tailString = Program.I().ocgcore.cards[i].tails.managedString;
                            con        = Program.I().ocgcore.cards[i].p.controller;
                        }
                    }
                }
            }
        }
        Program.I().cardDescription.setData(data, con == 0 ? GameTextureManager.myBack : GameTextureManager.opBack, tailString, data != null);
        if (Program.I().ocgcore.condition == Ocgcore.Condition.duel && Program.I().ocgcore.InAI == false && Program.I().room.mode != 2)
        {
            if (player == 0)
            {
                if (location == CardLocation.Deck)
                {
                    if (Program.I().book.lab != null)
                    {
                        destroy(Program.I().book.lab.gameObject);
                        Program.I().book.lab = null;
                    }


                    Program.I().book.lab = create(Program.I().New_decker, Vector3.zero, Vector3.zero, false, Program.ui_main_2d, true).GetComponent <UILabel>();
                    Program.I().book.realize();


                    Vector3 screenPosition = Input.mousePosition;
                    screenPosition.x -= 90;
                    screenPosition.y += Program.I().book.lab.height / 4;
                    screenPosition.z  = 0;
                    Vector3 worldPositin = Program.camera_main_2d.ScreenToWorldPoint(screenPosition);
                    Program.I().book.lab.transform.position = worldPositin;

                    return;
                }
            }
        }


        if (player == 1)
        {
            if (location == CardLocation.Deck)
            {
                if (Program.I().book.labop != null)
                {
                    destroy(Program.I().book.labop.gameObject);
                    Program.I().book.labop = null;
                }


                Program.I().book.labop = create(Program.I().New_decker, Vector3.zero, Vector3.zero, false, Program.ui_main_2d, true).GetComponent <UILabel>();
                Program.I().book.realize();


                Vector3 screenPosition = Input.mousePosition;
                screenPosition.x -= 90;
                screenPosition.y -= Program.I().book.labop.height / 4;
                screenPosition.z  = 0;
                Vector3 worldPositin = Program.camera_main_2d.ScreenToWorldPoint(screenPosition);
                Program.I().book.labop.transform.position = worldPositin;

                return;
            }
        }

        int count = 0;

        for (int i = 0; i < Program.I().ocgcore.cards.Count; i++)
        {
            if (Program.I().ocgcore.cards[i].gameObject.activeInHierarchy)
            {
                if ((Program.I().ocgcore.cards[i].p.location & (UInt32)location) > 0)
                {
                    if (Program.I().ocgcore.cards[i].p.controller == player)
                    {
                        count++;
                    }
                }
            }
        }
        int count_show = 0;

        for (int i = 0; i < Program.I().ocgcore.cards.Count; i++)
        {
            if (Program.I().ocgcore.cards[i].gameObject.activeInHierarchy)
            {
                if ((Program.I().ocgcore.cards[i].p.location & (UInt32)location) > 0)
                {
                    if (Program.I().ocgcore.cards[i].p.controller == player && Program.I().ocgcore.cards[i].isShowed == false)
                    {
                        count_show++;
                    }
                }
            }
        }
        if (hintText != null)
        {
            hintText.dispose();
            hintText = null;
        }
        if (count > 0)
        {
            hintText = new TextMaster(count.ToString(), Input.mousePosition, false);
        }
        Vector3 qidian    = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 12f);
        Vector3 zhongdian = new Vector3(2f * Program.I().ocgcore.getScreenCenter() - Input.mousePosition.x, Input.mousePosition.y, 19f);
        int     i_real    = 0;

        for (int i = 0; i < Program.I().ocgcore.cards.Count; i++)
        {
            if (Program.I().ocgcore.cards[i].gameObject.activeInHierarchy)
            {
                if ((Program.I().ocgcore.cards[i].p.location & (UInt32)location) > 0)
                {
                    if (Program.I().ocgcore.cards[i].p.controller == player)
                    {
                        if (Program.I().ocgcore.cards[i].isShowed == false)
                        {
                            Vector3 screen_vector_to_move = Vector3.zero;
                            int     gezi = 8;
                            if (count_show > 8)
                            {
                                gezi = count_show;
                            }
                            int index = count_show - 1 - i_real;
                            i_real++;
                            screen_vector_to_move =
                                (new Vector3(0, 50f * (float)Math.Sin(((float)index / (float)count) * 3.1415926f), 0))
                                +
                                qidian
                                +
                                ((float)index / (float)(gezi - 1)) * (zhongdian - qidian);
                            //iTween.MoveTo(Program.I().ocgcore.cards[i].gameObject, Camera.main.ScreenToWorldPoint(screen_vector_to_move), 0.5f);
                            //iTween.RotateTo(Program.I().ocgcore.cards[i].gameObject, new Vector3(-30, 0, 0), 0.1f);
                            Program.I().ocgcore.cards[i].TweenTo(Camera.main.ScreenToWorldPoint(screen_vector_to_move), new Vector3(-30, 0, 0), true);
                        }
                    }
                }
            }
        }
        if (count_show > 0)
        {
            Program.I().audio.clip = Program.I().zhankai;
            Program.I().audio.Play();
        }
    }
 public bool ifShowingThisCard(YGOSharp.Card card)
 {
     return(currentCard == card);
 }
Exemple #10
0
    public static void readCardData(this BinaryReader r, gameCard cardTemp = null)
    {
        gameCard cardToRefresh = cardTemp;
        int      flag          = r.ReadInt32();
        int      code          = 0;
        GPS      gps           = new GPS();

        if ((flag & (int)Query.Code) != 0)
        {
            code = r.ReadInt32();
        }
        if ((flag & (int)Query.Position) != 0)
        {
            gps           = r.ReadGPS();
            cardToRefresh = null;
            cardToRefresh = Program.I().ocgcore.GCS_cardGet(gps, false);
        }

        if (cardToRefresh == null)
        {
            return;
        }

        YGOSharp.Card data = cardToRefresh.get_data();

        if ((flag & (int)Query.Code) != 0)
        {
            if (data.Id != code)
            {
                data    = YGOSharp.CardsManager.Get(code);
                data.Id = code;
            }
        }
        if ((flag & (int)Query.Position) != 0)
        {
            cardToRefresh.p = gps;
        }


        if (data.Id > 0)
        {
            if ((cardToRefresh.p.location & (UInt32)CardLocation.Hand) > 0)
            {
                if (cardToRefresh.p.controller == 1)
                {
                    cardToRefresh.p.position = (Int32)CardPosition.FaceUpAttack;
                }
            }
        }

        if ((flag & (int)Query.Alias) != 0)
        {
            data.Alias = r.ReadInt32();
        }
        if ((flag & (int)Query.Type) != 0)
        {
            data.Type = r.ReadInt32();
        }

        int l1 = 0;

        if ((flag & (int)Query.Level) != 0)
        {
            l1 = r.ReadInt32();
        }
        int l2 = 0;

        if ((flag & (int)Query.Rank) != 0)
        {
            l2 = r.ReadInt32();
        }
        if (((flag & (int)Query.Level) != 0) || ((flag & (int)Query.Rank) != 0))
        {
            if (l1 > l2)
            {
                data.Level = l1;
            }
            else
            {
                data.Level = l2;
            }
        }

        if ((flag & (int)Query.Attribute) != 0)
        {
            data.Attribute = r.ReadInt32();
        }
        if ((flag & (int)Query.Race) != 0)
        {
            data.Race = r.ReadInt32();
        }
        if ((flag & (int)Query.Attack) != 0)
        {
            data.Attack = r.ReadInt32();
        }
        if ((flag & (int)Query.Defence) != 0)
        {
            data.Defense = r.ReadInt32();
        }
        if ((flag & (int)Query.BaseAttack) != 0)
        {
            r.ReadInt32();
        }
        if ((flag & (int)Query.BaseDefence) != 0)
        {
            r.ReadInt32();
        }
        if ((flag & (int)Query.Reason) != 0)
        {
            r.ReadInt32();
        }
        //if ((flag & (int)Query.ReasonCard) != 0)
        //    r.ReadInt32();
        if ((flag & (int)Query.EquipCard) != 0)
        {
            cardToRefresh.addTarget(Program.I().ocgcore.GCS_cardGet(r.ReadGPS(), false));
        }
        if ((flag & (int)Query.TargetCard) != 0)
        {
            int count = r.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                cardToRefresh.addTarget(Program.I().ocgcore.GCS_cardGet(r.ReadGPS(), false));
            }
        }
        if ((flag & (int)Query.OverlayCard) != 0)
        {
            var overs = Program.I().ocgcore.GCS_cardGetOverlayElements(cardToRefresh);
            int count = r.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                if (i < overs.Count)
                {
                    overs[i].set_code(r.ReadInt32());
                }
                else
                {
                    r.ReadInt32();
                }
            }
        }
        if ((flag & (int)Query.Counters) != 0)
        {
            int count = r.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                r.ReadInt32();
            }
        }
        if ((flag & (int)Query.Owner) != 0)
        {
            r.ReadInt32();
        }
        if ((flag & (int)Query.Status) != 0)
        {
            int status = r.ReadInt32();
            cardToRefresh.disabled = (status & 0x0001) == 0x0001;
        }
        if ((flag & (int)Query.LScale) != 0)
        {
            data.LScale = r.ReadInt32();
        }
        if ((flag & (int)Query.RScale) != 0)
        {
            data.RScale = r.ReadInt32();
        }
        cardToRefresh.set_data(data);
        //
    }
Exemple #11
0
    private void printSelected()
    {
        GameTextureManager.clearUnloaded();
        YGOSharp.Deck deck;
        DeckManager.FromYDKtoCodedDeck(DECK_PATH + deckSelected + ".ydk", out deck);
        int mainAll      = 0;
        int mainMonster  = 0;
        int mainSpell    = 0;
        int mainTrap     = 0;
        int sideAll      = 0;
        int sideMonster  = 0;
        int sideSpell    = 0;
        int sideTrap     = 0;
        int extraAll     = 0;
        int extraFusion  = 0;
        int extraLink    = 0;
        int extraSync    = 0;
        int extraXyz     = 0;
        int currentIndex = 0;

        int[] hangshu = UIHelper.get_decklieshuArray(deck.Main.Count);
        foreach (var item in deck.Main)
        {
            mainAll++;
            YGOSharp.Card c = YGOSharp.CardsManager.Get(item);
            if ((c.Type & (UInt32)CardType.Monster) > 0)
            {
                mainMonster++;
            }
            if ((c.Type & (UInt32)CardType.Spell) > 0)
            {
                mainSpell++;
            }
            if ((c.Type & (UInt32)CardType.Trap) > 0)
            {
                mainTrap++;
            }
            quickCards[currentIndex].reCode(item);
            Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu);
            quickCards[currentIndex].transform.localPosition = new Vector3
                                                               (
                -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, (int)v.y, hangshu[(int)v.x], 10)
                ,
                161.6f - v.x * 60f
                ,
                0
                                                               );
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
        }
        foreach (var item in deck.Side)
        {
            sideAll++;
            YGOSharp.Card c = YGOSharp.CardsManager.Get(item);
            if ((c.Type & (UInt32)CardType.Monster) > 0)
            {
                sideMonster++;
            }
            if ((c.Type & (UInt32)CardType.Spell) > 0)
            {
                sideSpell++;
            }
            if ((c.Type & (UInt32)CardType.Trap) > 0)
            {
                sideTrap++;
            }
            quickCards[currentIndex].reCode(item);
            quickCards[currentIndex].transform.localPosition = new Vector3
                                                               (
                -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, sideAll - 1, deck.Side.Count, 10)
                ,
                -181.1f
                ,
                0
                                                               );
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
        }
        foreach (var item in deck.Extra)
        {
            extraAll++;
            YGOSharp.Card c = YGOSharp.CardsManager.Get(item);
            if ((c.Type & (UInt32)CardType.Fusion) > 0)
            {
                extraFusion++;
            }
            if ((c.Type & (UInt32)CardType.Synchro) > 0)
            {
                extraSync++;
            }
            if ((c.Type & (UInt32)CardType.Xyz) > 0)
            {
                extraXyz++;
            }
            if ((c.Type & (UInt32)CardType.Link) > 0)
            {
                extraLink++;
            }
            quickCards[currentIndex].reCode(item);
            quickCards[currentIndex].transform.localPosition = new Vector3
                                                               (
                -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, extraAll - 1, deck.Extra.Count, 10)
                ,
                -99.199f
                ,
                0
                                                               );
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
        }
        while (true)
        {
            quickCards[currentIndex].clear();
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
            else
            {
                break;
            }
        }
        deckPanel.leftMain.text   = GameStringHelper._zhukazu + mainAll;
        deckPanel.leftExtra.text  = GameStringHelper._ewaikazu + extraAll;
        deckPanel.leftSide.text   = GameStringHelper._fukazu + sideAll;
        deckPanel.rightMain.text  = GameStringHelper._guaishou + mainMonster + " " + GameStringHelper._mofa + mainSpell + " " + GameStringHelper._xianjing + mainTrap;
        deckPanel.rightExtra.text = GameStringHelper._ronghe + extraFusion + " " + GameStringHelper._tongtiao + extraSync + " " + GameStringHelper._chaoliang + extraXyz + " " + GameStringHelper._lianjie + extraLink;
        deckPanel.rightSide.text  = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap;
    }
Exemple #12
0
    public static string getName(YGOSharp.Card card)
    {
        string limitot = "";

        switch (card.Ot)
        {
        case 1:
            limitot = "[OCG] ";
            break;

        case 2:
            limitot = "[TCG] ";
            break;

        case 3:
            limitot = "[OCG/TCG] ";
            break;

        case 4:
            limitot = "[Anime] ";
            break;
        }
        string re = "";

        try
        {
            re += "[b]" + card.Name + "[/b]";
            re += "\n";
            re += "[sup]" + limitot + "[/sup]";
            re += "\n";
            re += "[sup]" + card.Id.ToString() + "[/sup]";
            re += "\n";
        }
        catch (Exception e)
        {
        }

        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_EARTH))
        {
            re = "[F4A460]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_WATER))
        {
            re = "[D1EEEE]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_FIRE))
        {
            re = "[F08080]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_WIND))
        {
            re = "[B3EE3A]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_LIGHT))
        {
            re = "[EEEE00]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)game_attributes.ATTRIBUTE_DARK))
        {
            re = "[FF00FF]" + re + "[-]";
        }

        return(re);
    }
    public static string getName(YGOSharp.Card card)
    {
        string limitot = "";

        if ((card.Ot & 0x1) > 0)
        {
            limitot += "[OCG]";
        }
        if ((card.Ot & 0x2) > 0)
        {
            limitot += "[TCG]";
        }
        if ((card.Ot & 0x4) > 0)
        {
            limitot += "[Custom]";
        }
        if ((card.Ot & 0x8) > 0)
        {
            limitot += InterString.Get("[简中]");
        }
        string re = "";

        try
        {
            re += "[b]" + card.Name + "[/b]";
            re += "\n";
            re += "[sup]" + limitot + "[/sup]";
            re += "\n";
            re += "[sup]" + card.Id.ToString() + "[/sup]";
            re += "\n";
        }
        catch (Exception e)
        {
        }

        if (differ(card.Attribute, (int)CardAttribute.Earth))
        {
            re = "[F4A460]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Water))
        {
            re = "[D1EEEE]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Fire))
        {
            re = "[F08080]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Wind))
        {
            re = "[B3EE3A]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Light))
        {
            re = "[EEEE00]" + re + "[-]";
        }
        if (differ(card.Attribute, (int)CardAttribute.Dark))
        {
            re = "[FF00FF]" + re + "[-]";
        }

        return(re);
    }
Exemple #14
0
    private void printSelected()
    {
        GameTextureManager.clearUnloaded();
        YGOSharp.Deck deck;
        DeckManager.FromYDKtoCodedDeck("deck/" + deckSelected + ".ydk", out deck);
        int  mainAll      = 0;
        int  mainMonster  = 0;
        int  mainSpell    = 0;
        int  mainTrap     = 0;
        int  sideAll      = 0;
        int  sideMonster  = 0;
        int  sideSpell    = 0;
        int  sideTrap     = 0;
        int  extraAll     = 0;
        int  extraFusion  = 0;
        int  extraLink    = 0;
        int  extraSync    = 0;
        int  extraXyz     = 0;
        int  currentIndex = 0;
        bool resaveDeck   = false;

        int[] hangshu = UIHelper.get_decklieshuArray(deck.Main.Count);
        foreach (var item in deck.Main)
        {
            mainAll++;
            YGOSharp.Card c = YGOSharp.CardsManager.Get(item);
            if ((c.Type & (UInt32)CardType.Monster) > 0)
            {
                mainMonster++;
            }
            if ((c.Type & (UInt32)CardType.Spell) > 0)
            {
                mainSpell++;
            }
            if ((c.Type & (UInt32)CardType.Trap) > 0)
            {
                mainTrap++;
            }
            if (item != c.Id && c.Id != 0 && Program.I().setting.autoDeckUpdate)
            {
                deck.Deck_O.Main[deck.Deck_O.Main.IndexOf(item)] = c.Id;
                resaveDeck = true;
                quickCards[currentIndex].reCode(c.Id);
            }
            else
            {
                quickCards[currentIndex].reCode(item);
            }
            Vector2 v = UIHelper.get_hang_lieArry(mainAll - 1, hangshu);
            quickCards[currentIndex].transform.localPosition = new Vector3
                                                               (
                -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, (int)v.y, hangshu[(int)v.x], 10)
                ,
                161.6f - v.x * 60f
                ,
                0
                                                               );
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
        }
        foreach (var item in deck.Side)
        {
            sideAll++;
            YGOSharp.Card c = YGOSharp.CardsManager.Get(item);
            if ((c.Type & (UInt32)CardType.Monster) > 0)
            {
                sideMonster++;
            }
            if ((c.Type & (UInt32)CardType.Spell) > 0)
            {
                sideSpell++;
            }
            if ((c.Type & (UInt32)CardType.Trap) > 0)
            {
                sideTrap++;
            }
            if (item != c.Id && c.Id != 0 && Program.I().setting.autoDeckUpdate)
            {
                deck.Deck_O.Side[deck.Deck_O.Side.IndexOf(item)] = c.Id;
                resaveDeck = true;
                quickCards[currentIndex].reCode(c.Id);
            }
            else
            {
                quickCards[currentIndex].reCode(item);
            }
            quickCards[currentIndex].transform.localPosition = new Vector3
                                                               (
                -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, sideAll - 1, deck.Side.Count, 10)
                ,
                -181.1f
                ,
                0
                                                               );
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
        }
        foreach (var item in deck.Extra)
        {
            extraAll++;
            YGOSharp.Card c = YGOSharp.CardsManager.Get(item);
            if ((c.Type & (UInt32)CardType.Fusion) > 0)
            {
                extraFusion++;
            }
            if ((c.Type & (UInt32)CardType.Synchro) > 0)
            {
                extraSync++;
            }
            if ((c.Type & (UInt32)CardType.Xyz) > 0)
            {
                extraXyz++;
            }
            if ((c.Type & (UInt32)CardType.Link) > 0)
            {
                extraLink++;
            }
            if (item != c.Id && c.Id != 0 && Program.I().setting.autoDeckUpdate)
            {
                deck.Deck_O.Extra[deck.Deck_O.Extra.IndexOf(item)] = c.Id;
                resaveDeck = true;
                quickCards[currentIndex].reCode(c.Id);
            }
            else
            {
                quickCards[currentIndex].reCode(item);
            }
            quickCards[currentIndex].transform.localPosition = new Vector3
                                                               (
                -176.3f + UIHelper.get_left_right_indexZuo(0, 352f, extraAll - 1, deck.Extra.Count, 10)
                ,
                -99.199f
                ,
                0
                                                               );
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
        }
        while (true)
        {
            quickCards[currentIndex].clear();
            if (currentIndex <= 198)
            {
                currentIndex++;
            }
            else
            {
                break;
            }
        }
        deckPanel.leftMain.text   = GameStringHelper._zhukazu + mainAll;
        deckPanel.leftExtra.text  = GameStringHelper._ewaikazu + extraAll;
        deckPanel.leftSide.text   = GameStringHelper._fukazu + sideAll;
        deckPanel.rightMain.text  = GameStringHelper._guaishou + mainMonster + " " + GameStringHelper._mofa + mainSpell + " " + GameStringHelper._xianjing + mainTrap;
        deckPanel.rightExtra.text = GameStringHelper._ronghe + extraFusion + " " + GameStringHelper._tongtiao + extraSync + " " + GameStringHelper._chaoliang + extraXyz + " " + GameStringHelper._lianjie + extraLink;
        deckPanel.rightSide.text  = GameStringHelper._guaishou + sideMonster + " " + GameStringHelper._mofa + sideSpell + " " + GameStringHelper._xianjing + sideTrap;
        if (resaveDeck && Program.I().setting.autoDeckUpdate)
        {
            Program.I().deckManager.deck = deck;
            RMSshow_none("This deck has been updated becase it contained cards with beta IDs that got removed.\nPlease confirm your deck has no missing cards.");
            Config.Set("deckInUse", deckSelected);
            Program.I().deckManager.onSave();
            //resaveDecklist
        }
    }