public override void SendAction() { Ag.LogString("WasCardLevelup :: SendAction ... Started ... "); SendStr = ""; SendStr = SendStr.AddCodeKeyKKOID(User, 252); SendStr = SendStr.AddKeyValue("cardID", cardID); SendStr = SendStr.AddKeyValue("formatVersion", 1); // Deck AmCard curCard = User.GetCardIdOf(cardID); int bT = User.GetBuyType("FuncLevelUp" + (curCard.WAS.level + 1)); SendStr = SendStr.AddKeyValue("buyType", bT, false); SendStr = SendStr.AddParen(); postAction += () => { Ag.LogString("WasCardLevelup :: postAction " + RcvdStr); //JsonData jsUInfo = JsonMapper.ToObject (RcvdStr); if (Result.result == 0) { JSONNode contJs = NdObj ["cardInfoRslt"]; Ag.LogString("WasCardLevelup :: postAction .. >>>> next step is messageAction "); AmCard theCard = User.arrCard.GetMemberWithCond <AmCard> ((AmCard crd) => { return(crd.WAS.ID == contJs ["ID"].AsInt); }); theCard.WAS.WasCardParse(contJs); theCard.ScouterParse(); } messageAction(Result.result); }; SendAndRciv(); }
public bool ParseCards(JSONNode pData) { Ag.LogStartWithStr(1, " [< AmUserNet.cs >] <<<<< ParseCards >>>>> >> " + pData.Count); pData.ToString().HtLog(); try { arrCard.Clear(); for (int k = 0; k < pData.Count; k++) { Ag.LogIntense(1, true); Ag.LogString(pData [k].ToString() + " k : " + k); AmCard aObj = new AmCard(); // if (k == 0) { // 임 시 로 키 퍼 세 팅. // aObj.WAS.isKicker = false; // //polyNum = 101; // } else // aObj.WAS.isKicker = true; //if (aObj.WAS.ParseFrom (pData [k])) aObj.WAS.WasCardParse(pData [k]); aObj.ScouterParse(); arrCard.Add(aObj); } } catch { Ag.LogIntenseWord(" [< AmUserNet.cs >] Parse <<<<< ParseCards >>>>> E R R O R :: "); return(false); } return(true); }
// additionalBuyFlag : 0 (no), 1 (additional) // public List<string> playerNamze = new List<string> (); // public List<int> backNum = new List<int> (); // 0 : cash, 1 : gold /* * public WasPurchaseCard () * { * string hangen = WWW.UnEscapeURL ("%EC%83%9D%EC%84%B1%EC%9E%90"); * Ag.LogString ("WasPurchaseCard :: Generation ... " + hangen); * * dlgt_WillSend = () => { * return User.arrCard.Count < 30; * }; * } */ public override void SendAction() { Ag.LogString("WasPurchaseCard :: SendAction ... Started ... "); User.arrNewCard.Clear(); SendStr = ""; SendStr = SendStr.AddCodeKeyKKOID(User, 220); SendStr = SendStr.AddKeyValue("option", option); SendStr = SendStr.AddKeyValue("eaNum", eaNum); SendStr = SendStr.AddKeyValue("leagueType", leagueType); SendStr = SendStr.AddKeyValue("formatVersion", 2); // Deck //SendStr = SendStr.AddKeyValue ("kind", kind); // SendStr = SendStr.AddArray ("backNum", JsonMapper.ToJson (backNum)); // SendStr = SendStr.AddArray ("playerName", JsonMapper.ToJson (playerName)); SendStr = SendStr.AddKeyValue("additionalBuyFlag", additionalBuyFlag); SendStr = SendStr.AddKeyValue("buyType", buyType, false); SendStr = SendStr.AddParen(); postAction += () => { Ag.LogString("WasPurchaseCard :: postAction " + RcvdStr); //JsonData jsData = JsonMapper.ToObject (RcvdStr); JSONNode jsCard = NdObj ["arrCard"]; if (Result.result == 0) { for (int k = 0; k < jsCard.Count; k++) { AmCard nuCard = new AmCard(); nuCard.WAS.WasCardParse(jsCard [k]); nuCard.ScouterParse(); if (User.GetCardIdOf(jsCard [k] ["ID"].AsInt) == null) { nuCard.KickOrder = -1; } User.arrNewCard.Add(nuCard); } } // Card Update .... WasCardUpdate bObj = new WasCardUpdate() { User = User }; bObj.messageAction = (int pInt) => { }; // 0 : 성공, -1 : 코인부족, -2 : 기타 에러 Ag.LogString("WasPurchaseCard :: postAction " + Result.result + " New Card : " + User.arrNewCard.Count); messageAction(Result.result); //Ag.LogString (((string)(jsData ["cash1"])).LogWith ("cash1") + ((string)(jsData ["cash2"])).LogWith ("cash2") + ((string)(jsData ["gold"])).LogWith ("gold")); }; SendAndRciv(); }
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); }
//public int buyType; // "arrItem":["itemTypeID":"CardCombiAdvt" ,"itemTypeID":"CardCombiAdvtHigh" ,"itemTypeID":"CardCombiGrade"]} public override void SendAction() { Ag.LogString("WasCardCombi :: SendAction ... Started ... "); User.arrNewCard.Clear(); SendStr = ""; SendStr = SendStr.AddCodeKeyKKOID(User, 253); SendStr = SendStr.AddKeyValue("formatVersion", 2); SendStr = SendStr.AddKeyValue("cardID1", cardID1); SendStr = SendStr.AddKeyValue("cardID2", cardID2); SendStr = SendStr.AddKeyValue("cardID3", cardID3); SendStr = SendStr.AddKeyValue("buyType", User.GetBuyType("FunCardMix")); string strArr = ""; // 0 일 때 에러 안나게 if (arrItemStr.Count == 0) { SendStr = SendStr.AddArray("arrItem", "[]"); } else { for (int k = 0; k < arrItemStr.Count; k++) { string curStr = ""; curStr = curStr.AddKeyValue("itemTypeID", arrItemStr [k], false); //, ; curStr = curStr.AddParen(); strArr += curStr; if (k != (arrItemStr.Count - 1)) { strArr += ","; } } strArr = strArr.AddSqreBrakt(); SendStr = SendStr.AddArray("arrItem", strArr, false); } SendStr = SendStr.AddParen(); postAction += () => { Ag.LogString("WasCardCombi :: postAction " + RcvdStr); //JsonData jsUInfo = JsonMapper.ToObject (RcvdStr); if (Result.result == 0) { JSONNode contJs = NdObj ["cardInfoRslt"]; contJs.ToString().HtLog(); Ag.LogString("WasCardCombi :: postAction .. >>>> next step is messageAction "); AmCard theCard = new AmCard(); theCard.WAS.WasCardParse(contJs); theCard.ScouterParse(); if (User.GetCardIdOf(contJs ["ID"].AsInt) == null) { theCard.KickOrder = -1; } User.arrNewCard.Add(theCard); theCard.mustUpdate = true; // Card Update .... WasCardUpdate bObj = new WasCardUpdate() { User = User }; bObj.messageAction = (int pInt) => { }; } messageAction(Result.result); }; SendAndRciv(); }