示例#1
0
    private void TestGroupSizes(group grp, gameCard card, bool isTable, bool isHand)
    {
        string obj         = "Group[" + grp.name + "]";
        string extraWidth  = "";
        string extraHeight = "";

        if (isTable)
        {
            obj = "Table";
        }
        else if (isHand)
        {
            obj = "Hand";
        }
        else
        {
            extraWidth  = "You should set the Width to " + card.width + " (The width of your card)";
            extraHeight = "You should set the Height to " + card.height + " (The height of your card)";
        }

        var w = TryThrow(() => int.Parse(grp.width), "Can not parse {0} Width into number, `{1}` is invalid.", obj, grp.width);
        var h = TryThrow(() => int.Parse(grp.height), "Can not parse {0} Height into number, `{1}` is invalid.", obj, grp.height);

        if (w == 0)
        {
            Warning("Your {0} Width is set to 0. OCTGN will automatically set this to a 1 when it runs. " + extraWidth, obj);
        }
        if (h == 0)
        {
            Warning("Your {0} Height is set to 0. OCTGN will automatically set this to a 1 when it runs. " + extraHeight, obj);
        }
    }
示例#2
0
    //internal static string getGPSstringPosition(GPS p1)
    //{
    //    string res = "";
    //    if ((p1.location & (UInt32)CardLocation.Overlay) > 0)
    //    {
    //        res += InterString.Get("(被叠放)");
    //    }
    //    else
    //    {
    //        if ((p1.position & (UInt32)CardPosition.FaceUpAttack) > 0)
    //        {
    //            res += InterString.Get("(表侧攻击)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.FaceUp_DEFENSE) > 0)
    //        {
    //            res += InterString.Get("(表侧守备)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.FaceDownAttack) > 0)
    //        {
    //            res += InterString.Get("(里侧攻击)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.FaceDown_DEFENSE) > 0)
    //        {
    //            res += InterString.Get("(里侧守备)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.Attack) > 0)
    //        {
    //            res += InterString.Get("(攻击)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.POS_DEFENSE) > 0)
    //        {
    //            res += InterString.Get("(守备)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.FaceUp) > 0)
    //        {
    //            res += InterString.Get("(表侧)");
    //        }
    //        else if ((p1.position & (UInt32)CardPosition.POS_DEFENSE) > 0)
    //        {
    //            res += InterString.Get("(里侧)");
    //        }
    //    }

    //    return res;
    //}

    internal static string getGPSstringName(gameCard card, bool green = false)
    {
        string res = "";

        res += getGPSstringLocation(card.p) + "\n「" + getSuperName(card.get_data().Name, card.get_data().Id) + "」";
        if (green)
        {
            return("[00ff00]" + res + "[-]");
        }
        return(res);
    }
示例#3
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);
        //
    }