Ejemplo n.º 1
0
    public bool ParseExchange(JSONNode pData, AmUser pEnemy)
    {
        Ag.LogStartWithStr(3, "NodeGameObject  ::  Parse Exchange   ");
        pEnemy = EnAmUser = new AmUser();

        Ag.LogString(" >>>   User   <<<     " + pData ["User"].ToString());

        JSONNode user = JSON.Parse(pData ["User"].ToString().RecoverFromDodgeStr(" ` ", true));

        EnAmUser.WAS.KkoID     = user ["KkoID"];
        EnAmUser.WAS.KkoNick   = user ["KkoNick"];
        EnAmUser.KkoNickEncode = user ["KNickEncode"];
        Ag.LogString("   >>>   " + EnAmUser.WAS.KkoID + EnAmUser.WAS.KkoNick);

        Ag.LogString(" >>>   Item   <<<     " + pData ["arrItemWas"]);
        JSONNode arrItm = JSON.Parse(pData ["arrItemWas"].ToString().RecoverFromDodgeStr(" ` ", true));

        for (int k = 0; k < arrItm.Count; k++)
        {
            Ag.LogString(arrItm [k].ToString());
            try {
                AmItem itm = new AmItem();
                itm.ParseFrom(arrItm [k]);
                itm.ShowMyself();
                EnAmUser.arrItem.Add(itm);
            } catch {
                Ag.LogString("                 ::  >>>    Item Parse   !!!!!     E R R O R    !!!!! ", pWichtig: true);
            }
        }
        Ag.LogNewLine(2);

        Ag.LogString(" >>>   Uniform   <<<     " + pData ["arrUniform"]);
        arrItm = JSON.Parse(pData ["arrUniform"].ToString().RecoverFromDodgeStr(" ` ", true));
        for (int k = 0; k < arrItm.Count; k++)
        {
            Ag.LogString(arrItm [k].ToString());
            AmUniform nUni = new AmUniform();
            EnAmUser.arrUniform.Add(nUni);
            try {
                nUni.Parse(arrItm [k]);
                nUni.WasParseColorStringToKickKeepObj();
            } catch {
                Ag.LogString("                 ::  >>>    ParseColorInfo   !!!!!     E R R O R    !!!!! ", pWichtig: true);
            }
        }
        Ag.LogString("NodeGameObject  ::  Parse Exchange           >>>>>      >>>>>    ");
        Ag.LogIntense(5, false);
        return(true);
    }
Ejemplo n.º 2
0
    public AmUser ParseFrom(JSONNode pJData)
    {
        AmUser rUsr = new AmUser(true, "NodeEnemyAmUserParse");

        "NodeRltd :: NodeAmUser :: ParseFrom  ".HtLog();
        try {
            rUsr.WAS.KkoID       = pJData ["KkoID"];   //.ToString ().RemoveQuotationMark ();
            rUsr.WAS.KkoNick     = pJData ["KkoNick"]; //.ToString ().RemoveQuotationMark ();
            rUsr.KkoNickEncode   = pJData ["KNickEncode"];
            rUsr.TeamNameEncoded = pJData ["TeamNameEncoded"];
            rUsr.WAS.League      = pJData ["League"];

            //Ag.NetExcpt.GamingEnemyID = rUsr.WAS.KkoID;
        } catch {
            Ag.LogString(" NodeRltd :: ParseFrom ::  >>>    KkoID   KkoNick  !!!!!     E R R O R    !!!!! ", pWichtig: true);
        }
        if (rUsr.KkoNickEncode == "%E0%B8%B8")
        {
            Ag.LogIntenseWord("   >>>  KkoNick   <<<   " + rUsr.KkoNickEncode);
            rUsr.KkoNickEncode = "..";
        }

        try {
            string contWinTryNot = pJData ["contWin"];
            rUsr.ContWinStarted = contWinTryNot == "TRY";
            Ag.LogString(" NodeRltd ::  " + rUsr.ContWinStarted.ShowBool(" ContWin ", " Try", " Not"));
        } catch {
            Ag.LogString(" NodeRltd :: ParseFrom ::  >>>    ContWin TRY  NOT");
        }
        Ag.LogString(" NodeRltd :: ParseFrom ::  >>>    KkoID : " + rUsr.WAS.KkoID + "   KkoNick : " + rUsr.WAS.KkoNick + "  !!!!! ");

        JSONNode itemArr = pJData ["arrItemWas"];

        ("    NodeRltd :: NodeAmUser :: ParseFrom >>          Item Array Parsing ____________" + itemArr.Count + "_____________ ").HtLog();
        for (int k = 0; k < itemArr.Count; k++)
        {
            try {
                AmItem itm = new AmItem();
                itm.ParseEnemyFrom(itemArr [k]);
                //itm.WAS = JsonMapper.ToObject<WasItem> (itemArr [k].ToJson ());
                itm.ShowMyself();
                rUsr.arrItem.Add(itm);
            } catch {
                Ag.LogString(" NodeRltd :: ParseFrom ::  >>>    Item Parse   !!!!!     E R R O R    !!!!! ", pWichtig: true);
            }
        }

        JSONNode uniformArr = pJData ["arrWasUniform"];

        Ag.LogStartWithStr(1, "    NodeRltd :: NodeAmUser :: ParseFrom >>          Uniform Array Parsing ____________" + uniformArr.Count + "_____________ ");
        for (int k = 0; k < uniformArr.Count; k++)
        {
            AmUniform nUni = new AmUniform();
            rUsr.arrUniform.Add(nUni);
            try {
                nUni.Parse(uniformArr [k]);
                nUni.WasParseColorStringToKickKeepObj();
            } catch {
                Ag.LogString(" NodeRltd :: ParseFrom ::  >>>    ParseColorInfo   !!!!!     E R R O R    !!!!! ", pWichtig: true);
            }
        }

        JSONNode cardArr = pJData ["arrCard"];

        Ag.LogStartWithStr(1, "    NodeRltd :: NodeAmUser :: ParseFrom >>          Card Array Parsing ____________" + cardArr.Count + "_____________ ");
        //cardArr.ToJson ().ToString ().HtLog ();
        for (int k = 0; k < cardArr.Count; k++)
        {
            try {
                AmCard nCard = new AmCard();
                nCard.WAS.WasCardParse(cardArr [k]);
                nCard.ScouterParse();
                rUsr.arrCard.Add(nCard);
            } catch {
                Ag.LogString(" NodeRltd :: ParseFrom ::  >>>    Card Parsing Failure    !!!!!     E R R O R    !!!!! ", pWichtig: true);
            }
        }
//        JSONNode cstmdArr = pJData ["arrCostume"];  // Should be deprecate ....
//        ("    NodeRltd :: NodeAmUser :: ParseFrom >>        Costume Array Parsing ____________" + cstmdArr.Count + "_____________ ").HtLog ();
//        for (int k = 0; k < cstmdArr.Count; k++) {
//            arrCostume.Add (new AmCostume (cstmdArr [k]));
//        }

        JSONNode cstmWasArr = pJData ["arrCostumeWas"];

        ("    NodeRltd :: NodeAmUser :: ParseFrom >>        Costume Was Array Parsing ____________" + cstmWasArr.Count + "_____________ ").HtLog();
        for (int k = 0; k < cstmWasArr.Count; k++)
        {
            AmCostume nObj = new AmCostume();
            nObj.WAS.ParseFrom(cstmWasArr [k]);
            rUsr.arrCostume.Add(nObj);
        }

        rUsr.ApplyCurrentDeck();
        //rUsr.ApplyDeckItemBeforeGame ();

        return(rUsr);
    }