Exemplo n.º 1
0
    public void EventViewMessage(JSONObject message)
    {
        selectMessage = message;
        Utils.SetActive(scrollview.gameObject, false);
        Utils.SetActive(viewMessagePanel, true);
        Utils.SetActive(btnBack.gameObject, true);
        messageTitle.text   = message.GetString("title");
        messageContent.text = message.GetString("message");
        int goldVal = message.GetInt("goldVal");
        int gemVal  = message.GetInt("gemVal");

        if (goldVal <= 0 && gemVal <= 0)
        {
            Utils.SetActive(goldObject, false);
            Utils.SetActive(gemObject, false);
            EventDelegate.Set(btnClaim.onClick, delegate() {});
            Utils.SetActive(btnClaim.gameObject, false);
        }
        else
        {
            Utils.SetActive(goldObject, goldVal > 0);
            Utils.SetActive(gemObject, gemVal > 0);
            goldLabel.text = goldVal.ToString("N0");
            gemLabel.text  = gemVal.ToString("N0");
            rewardTable.Reposition();
            Utils.SetActive(btnClaim.gameObject, true);
            EventDelegate.Set(btnClaim.onClick, delegate() { ClaimReward(message.GetInt("type"), message.GetLong("createdAt"), message.GetString("fromUsername")); });
        }
    }
Exemplo n.º 2
0
 bool HandlePush(PushMessage message)
 {
     try
     {
         JSONObject customJson = new JSONObject(message.CustomData);
         if (customJson.Has("r") && customJson.Has("g") && customJson.Has("b"))
         {
             int r = customJson.GetInt("r");
             int g = customJson.GetInt("g");
             int b = customJson.GetInt("b");
             if (CurrentActivity != null)
             {
                 CurrentActivity.Window.DecorView.FindViewById <View>(Android.Resource.Id.Content).SetBackgroundColor(Android.Graphics.Color.Rgb(r, g, b));
             }
         }
         if (customJson.Has("id"))
         {
             Intent intent = new Intent(ApplicationContext, typeof(SecondActivity));
             intent.SetFlags(ActivityFlags.NewTask);
             intent.PutExtra(SecondActivity.PUSH_MESSAGE_KEY, message.ToJson().ToString());
             ApplicationContext.StartActivity(intent);
             return(true);
         }
     }
     catch (Exception)
     {}
     return(false);
 }
Exemplo n.º 3
0
  public void UpdateRowData(JSONObject data, LeaderboardScreen.Tab selectedTab) {
    rowData = data;
    
    if (AccountManager.Instance.IsYou(rowData.GetString("username"))) {
      background.spriteName = "PopupBackground";
    } else {
      background.spriteName = "Global_Window_Paper";
    }
    
    playerNameLabel.text = rowData.GetString("displayName");
    if (selectedTab == LeaderboardScreen.Tab.TOP_RICHER) {
      cashLabel.text = rowData.GetLong("cash").ToString("N0") + "$";
    } else {
      // cashLabel.text = Utils.Localize("Top_Winner_Match_Text", new string[1] {rowData.GetInt("winMatchNumb").ToString("N0")});
      cashLabel.text = Localization.Format("Top_Winner_Match_Text", rowData.GetInt("bossKill").ToString("N0"));
    }
    rank = rowData.GetInt("rank");
    if (rank <= 3) {
			Utils.SetActive(rankBackground, false);
			Utils.SetActive(rankIcon.gameObject, true);
      rankIcon.spriteName = "Chat_RankIcon0" + rank;
    } else {
			Utils.SetActive(rankBackground, true);
			Utils.SetActive(rankIcon.gameObject, false);
      rankLabel.text = rank.ToString();
    }
    eventTrigger.inputParams = new object[] {rowData.GetString("username")};
    EventDelegate.Set(eventTrigger.onClick, delegate() { EventShowUserInfo((string)eventTrigger.inputParams[0]); });
  }
Exemplo n.º 4
0
 public TLMBGameConfig(JSONObject jsonData)
 {
     type                 = (Type)jsonData.GetInt("type");
     coinPerCard          = jsonData.GetInt("coinPerCard");
     firstRankRewardCoin  = jsonData.GetInt("firstRankRewardCoin");
     secondRankRewardCoin = jsonData.GetInt("secondRankRewardCoin");
 }
Exemplo n.º 5
0
 private void ChangeBossFadeIn()
 {
     boss.Destroy();
     boss = null;
     Init(newBossData.GetInt("dIndex"), newBossData.GetInt("dHP"), newBossData.GetInt("dMaxHP"));
     FadeIn();
 }
Exemplo n.º 6
0
        //*****************************************************
        //*
        //*		Convenience
        //*
        //*****************************************************

        /// <summary>
        /// Puts up the selection view. </summary>
        /// <param name="range"> </param>
        /// <param name="text"> </param>
        /// <param name="handleBounds">
        /// @return </param>
        protected void HandleSelection(string range, string text, string handleBounds)
        {
            try
            {
                JSONObject selectionBoundsObject = new JSONObject(handleBounds);

                float scale = GetDensityIndependentValue(Scale, mContext);

                Rect handleRect = new Rect();
                handleRect.Left   = (int)(GetDensityDependentValue(selectionBoundsObject.GetInt("left"), Context) * scale);
                handleRect.Top    = (int)(GetDensityDependentValue(selectionBoundsObject.GetInt("top"), Context) * scale);
                handleRect.Right  = (int)(GetDensityDependentValue(selectionBoundsObject.GetInt("right"), Context) * scale);
                handleRect.Bottom = (int)(GetDensityDependentValue(selectionBoundsObject.GetInt("bottom"), Context) * scale);

                mSelectionBounds = handleRect;
                mSelectedRange   = range;
                mSelectedText    = text;

                if (!InSelectionMode)
                {
                    StartSelectionMode();
                }

                DrawSelectionHandles();
            }
            catch (JSONException e)
            {
                // TODO Auto-generated catch block
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
        }
Exemplo n.º 7
0
    public void SetResults(JSONObject jsonData)
    {
        spinDataResult = jsonData;
        resultsData    = jsonData.GetArray("items");
        winningGold    = jsonData.GetArray("wGold");
        // Calculate extra data (winning type, winning count from list result items)
        JSONObject extraData = SlotCombination.CalculateCombination(resultsData, GetNumLine());

        winningCount = extraData.GetArray("wCount");
        winningType  = extraData.GetArray("wType");
        //
        isJackpot    = jsonData.GetBoolean("isJP");
        freeSpinLeft = jsonData.GetInt("frLeft");
        isBigWin     = jsonData.GetBoolean("bWin");
        gotFreeSpin  = jsonData.GetInt("frCount") > 0;
        // bool[] winingItems = new bool[15];
        // for (int i = 0; i < winningGold.Length; i++) {
        //  if (winningGold[i].Number > 0) {
        //      for (int j = 0; j < SlotCombination.NUM_REELS; j++) {
        //          winingItems[SlotCombination.COMBINATION[i, j]] = true;
        //      }
        //  }
        // }
        for (int i = 0; i < slotReels.Length; i++)
        {
            slotReels[i].SetResults(new int[3] {
                (int)resultsData[i * 3].Number, (int)resultsData[i * 3 + 1].Number, (int)resultsData[i * 3 + 2].Number
            });
        }
    }
Exemplo n.º 8
0
        /// <summary>
        /// Calculates the context menu display rect </summary>
        /// <param name="menuBounds"> </param>
        /// <returns> The display Rect </returns>
        protected Rect GetContextMenuBounds(string menuBounds)
        {
            try
            {
                JSONObject menuBoundsObject = new JSONObject(menuBounds);

                float scale = GetDensityIndependentValue(Scale, mContext);

                Rect displayRect = new Rect();
                displayRect.Left   = (int)(GetDensityDependentValue(menuBoundsObject.GetInt("left"), Context) * scale);
                displayRect.Top    = (int)(GetDensityDependentValue(menuBoundsObject.GetInt("top") - 25, Context) * scale);
                displayRect.Right  = (int)(GetDensityDependentValue(menuBoundsObject.GetInt("right"), Context) * scale);
                displayRect.Bottom = (int)(GetDensityDependentValue(menuBoundsObject.GetInt("bottom") + 25, Context) * scale);

                return(displayRect);
            }
            catch (JSONException e)
            {
                // TODO Auto-generated catch block
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }

            return(null);
        }
 public virtual void TestPerUserResourcesJSON()
 {
     //Start RM so that it accepts app submissions
     rm.Start();
     try
     {
         rm.SubmitApp(10, "app1", "user1", null, "b1");
         rm.SubmitApp(20, "app2", "user2", null, "b1");
         //Get JSON
         WebResource    r        = Resource();
         ClientResponse response = r.Path("ws").Path("v1").Path("cluster").Path("scheduler/"
                                                                                ).Accept(MediaType.ApplicationJson).Get <ClientResponse>();
         NUnit.Framework.Assert.AreEqual(MediaType.ApplicationJsonType, response.GetType()
                                         );
         JSONObject json          = response.GetEntity <JSONObject>();
         JSONObject schedulerInfo = json.GetJSONObject("scheduler").GetJSONObject("schedulerInfo"
                                                                                  );
         JSONObject b1 = GetSubQueue(GetSubQueue(schedulerInfo, "b"), "b1");
         //Check users user1 and user2 exist in b1
         JSONArray users = b1.GetJSONObject("users").GetJSONArray("user");
         for (int i = 0; i < 2; ++i)
         {
             JSONObject user = users.GetJSONObject(i);
             NUnit.Framework.Assert.IsTrue("User isn't user1 or user2", user.GetString("username"
                                                                                       ).Equals("user1") || user.GetString("username").Equals("user2"));
             user.GetInt("numActiveApplications");
             user.GetInt("numPendingApplications");
             CheckResourcesUsed(user);
         }
     }
     finally
     {
         rm.Stop();
     }
 }
Exemplo n.º 10
0
 public void UpdateData(JSONObject data) {
   roomData = data;
   roomNumberLabel.text = data.GetString("name");
   minBetLabel.text = data.GetInt("minBet").ToString("N0");
   sitStatusLabel.text = data.GetInt("numUsers") + "/4";
   eventTrigger.inputParams = new object[] {roomData.GetString("id")};
   EventDelegate.Set(eventTrigger.onClick, delegate() { EventJoinSelectedRoom((string)eventTrigger.inputParams[0]); });
 }
Exemplo n.º 11
0
 public void UpdateData(JSONObject data)
 {
     roomData                 = data;
     roomNumberLabel.text     = data.GetString("name");
     minBetLabel.text         = data.GetInt("minBet").ToString("N0");
     sitStatusLabel.text      = data.GetInt("numUsers") + "/4";
     eventTrigger.inputParams = new object[] { roomData.GetString("id") };
     EventDelegate.Set(eventTrigger.onClick, delegate() { EventJoinSelectedRoom((string)eventTrigger.inputParams[0]); });
 }
Exemplo n.º 12
0
 public void FromJson(JSONObject json)
 {
     Lat      = json.GetFloat("Lat");
     Lon      = json.GetFloat("Lon");
     Zoom     = json.GetInt("Zoom");
     Scale    = json.GetInt("Scale");
     Range    = json.GetInt("Range");
     TileSize = json.GetInt("TileSize");
 }
Exemplo n.º 13
0
        private TimeSpan JsonToTimeSpan(JSONObject time)
        {
            var days         = time.GetInt("days");
            var hours        = time.GetInt("hours");
            var minutes      = time.GetInt("minutes");
            var seconds      = time.GetInt("seconds");
            var milliseconds = time.GetInt("milliseconds");

            return(new TimeSpan(days, hours, minutes, seconds, milliseconds));
        }
Exemplo n.º 14
0
        /// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/>
        /// <exception cref="System.Exception"/>
        public virtual void VerifyClusterSchedulerFifo(JSONObject json)
        {
            NUnit.Framework.Assert.AreEqual("incorrect number of elements", 1, json.Length());
            JSONObject info = json.GetJSONObject("scheduler");

            NUnit.Framework.Assert.AreEqual("incorrect number of elements", 1, info.Length());
            info = info.GetJSONObject("schedulerInfo");
            NUnit.Framework.Assert.AreEqual("incorrect number of elements", 11, info.Length()
                                            );
            VerifyClusterSchedulerFifoGeneric(info.GetString("type"), info.GetString("qstate"
                                                                                     ), (float)info.GetDouble("capacity"), (float)info.GetDouble("usedCapacity"), info
                                              .GetInt("minQueueMemoryCapacity"), info.GetInt("maxQueueMemoryCapacity"), info.GetInt
                                                  ("numNodes"), info.GetInt("usedNodeCapacity"), info.GetInt("availNodeCapacity"),
                                              info.GetInt("totalNodeCapacity"), info.GetInt("numContainers"));
        }
Exemplo n.º 15
0
	public void SetUser(JSONObject user) {
	  username = user.GetString("username");
		password = user.GetString("password");
		displayName = user.GetString("displayName");
		cash = user.GetLong("cash");
		gem = user.GetInt("gem");
		bossKilled = user.GetInt("bossKill");
		lastClaimedDaily = user.GetLong("lastDaily");
		fbId = user.GetString("facebookId");
		avatarLink = user.GetString("avatar");
		lastReadInboxTime = user.GetLong("lastReadInboxTime");
		lastInboxTime = user.GetLong("lastInboxTime");
		Debug.Log("SetUser " + user.ToString());
		// friends = user.GetArray("friends");
	}
Exemplo n.º 16
0
        private async void OpenDiseaseList(object sender, EventArgs e)
        {
            _progressBarDialog.Show();
            await Task.Run(async() => {
                try {
                    //Utils.GetDefaults("QrId")
                    // string response = await WebServices.WebServices.Get($"{Constants.PublicServerAddress}/api/getUserBenefits/{Utils.GetDefaults("Id")}", Utils.GetDefaults("Token"));
                    string response = await WebServices.WebServices.Get($"{Constants.PublicServerAddress}/api/getAllBenefits/", Utils.GetDefaults("Token"));
                    Log.Error("Debug Log in " + nameof(AsistentForm), "Response: " + response);
                    var jsonResponse = new JSONObject(response);
                    Log.Error("ASISTEN FORM BENEFITS", jsonResponse.ToString());
                    if (jsonResponse.GetInt("status") == 2)
                    {
                        JSONArray dataArray = jsonResponse.GetJSONArray("data");
                        var items           = new List <SearchListModel>();
                        for (var i = 0; i < dataArray.Length(); i++)
                        {
                            items.Add(new SearchListModel {
                                Id    = dataArray.GetJSONObject(i).GetInt("id"),
                                Title = dataArray.GetJSONObject(i).GetString("benefit")
                            });
                        }

                        var intent = new Intent(Activity, typeof(SearchListActivity));
                        intent.PutExtra("Items", JsonConvert.SerializeObject(items));
                        intent.PutExtra("SelectedItems", JsonConvert.SerializeObject(_selectedBenefits));
                        StartActivityForResult(intent, 1);
                    }
                } catch (Exception ex) {
                    Log.Error("error la beneficii", ex.Message);
                }
            });

            _progressBarDialog.Dismiss();
        }
Exemplo n.º 17
0
            private void GetDiseaseList(object sender, EventArgs e)
            {
                var progressBarDialog = new ProgressBarDialog("Va rugam asteptati", "Se aduc date...", Activity, false);

                progressBarDialog.Show();
                Task.Run(async() =>
                {
                    string result = await WebServices.WebServices.Get(Constants.PublicServerAddress + "/api/getDisease", Utils.GetDefaults("Token"));
                    if (result == null)
                    {
                        return;
                    }

                    var arrayOfDiseases = new JSONArray(result);
                    var items           = new List <SearchListModel>();
                    for (var i = 0; i < arrayOfDiseases.Length(); i++)
                    {
                        var jsonModel = new JSONObject(arrayOfDiseases.Get(i).ToString());

                        items.Add(new SearchListModel
                        {
                            Id    = jsonModel.GetInt("cod"),
                            Title = jsonModel.GetString("denumire")
                        });
                    }

                    var intent = new Intent(Activity, typeof(SearchListActivity));
                    intent.PutExtra("Items", JsonConvert.SerializeObject(items));
                    intent.PutExtra("SelectedItems", JsonConvert.SerializeObject(_selectedDiseases));
                    StartActivityForResult(intent, 3);

                    Activity.RunOnUiThread(progressBarDialog.Dismiss);
                });
            }
Exemplo n.º 18
0
        /// <summary>
        /// 虚拟 DataTable内容
        /// </summary>
        /// <returns></returns>
        public static DataTable CreatTable()
        {
            string json = "{\"total\":8,\"rows\":[{\"VehicleID\":\"粤BY818T\",\"Mileage\":0},{\"VehicleID\":\"粤B594L0\",\"Mileage\":0},{\"VehicleID\":\"粤B8C97M\",\"Mileage\":52718.32},{\"VehicleID\":\"粤B2K52P\",\"Mileage\":109411},{\"VehicleID\":\"粤BKB951\",\"Mileage\":43296.82},{\"VehicleID\":\"粤BW83B7\",\"Mileage\":8711.193},{\"VehicleID\":\"粤BK716T\",\"Mileage\":72072.73},{\"VehicleID\":\"粤B2W6G9\",\"Mileage\":167095.3}]}";

            JSONObject obj  = new JSONObject(json);
            int        num  = obj.GetInt("total");
            JSONArray  jArr = obj.GetJSONArray("rows");



            //创建DataTable 将数据库中没有的数据放到这个DT中
            DataTable datatable = new DataTable();

            datatable.Columns.Add("车辆名称", typeof(string));
            datatable.Columns.Add("行驶里程", typeof(string));
            datatable.Columns.Add("时间区间", typeof(string));
            //创建DatatTable 结束---------------------------

            //开始给临时datatable赋值
            for (int i = 0; i < 7; i++)
            {
                JSONObject obj2 = jArr.GetJSONObject(i);
                DataRow    row  = datatable.NewRow();
                row["车辆名称"] = obj2.GetString("VehicleID");
                //row["行驶里程"] = obj2.GetString("Mileage");
                //row["时间区间"] = "哈哈哈  ";
                datatable.Rows.Add(row);
            }
            return(datatable);
        }
Exemplo n.º 19
0
 public void SetUser(JSONObject user)
 {
     username          = user.GetString("username");
     password          = user.GetString("password");
     displayName       = user.GetString("displayName");
     cash              = user.GetLong("cash");
     gem               = user.GetInt("gem");
     bossKilled        = user.GetInt("bossKill");
     lastClaimedDaily  = user.GetLong("lastDaily");
     fbId              = user.GetString("facebookId");
     avatarLink        = user.GetString("avatar");
     lastReadInboxTime = user.GetLong("lastReadInboxTime");
     lastInboxTime     = user.GetLong("lastInboxTime");
     Debug.Log("SetUser " + user.ToString());
     // friends = user.GetArray("friends");
 }
        private async Task <List <SearchListModel> > GetDiseaseList()
        {
            var items = new List <SearchListModel>();
            await Task.Run(async() =>
            {
                string result = await WebServices.WebServices.Get(Constants.PublicServerAddress + "/api/getDisease", Utils.GetDefaults("Token"));
                if (result != null)
                {
                    Log.Error("UpdateProfileActivity", "RESULT " + result);
                    var arrayOfDiseases = new JSONArray(result);

                    for (var i = 0; i < arrayOfDiseases.Length(); i++)
                    {
                        var jsonModel = new JSONObject(arrayOfDiseases.Get(i).ToString());

                        items.Add(new SearchListModel
                        {
                            Id    = jsonModel.GetInt("cod"),
                            Title = jsonModel.GetString("denumire")
                        });
                    }
                    Log.Error("UpdateProfileActivity", "RESULT" + items.Count);
                }
                else
                {
                    Log.Error("UpdateProfileActivity", "RESULT is null ");
                }
            });

            return(items);
        }
Exemplo n.º 21
0
	public void Init(JSONObject jsonData) {
		roomId = jsonData.GetString("roomId");
		userGames.Clear();
		JSONArray userGameArray = jsonData.GetArray("userGames");

		for (int i = 0; i < userGameArray.Length; i++) {
			userGames.Add(new TLMBGame(userGameArray[i].Obj));
		}

		droppedCards = new TLMBCombination(jsonData.GetString("droppedCards"));
		roundDroppedCards = new TLMBCombination(jsonData.GetString("roundDroppedCards"));
		activeUserSeatIndex = jsonData.GetInt("activeUserSeatIndex");
		state = (State)jsonData.GetInt("state");
		gameConfig = new TLMBGameConfig(jsonData.GetObject("gameConfig"));
		remainingSeconds = jsonData.GetInt("remainingSeconds");
	}
Exemplo n.º 22
0
	public void Init(JSONObject jsonData) {
		userId = jsonData.GetString("userId");
		seatIndex = jsonData.GetInt("seatIndex");
		isHost = jsonData.GetBoolean("isHost");
		state = (State)jsonData.GetInt("state");
		hand = new TLMBHand();

		if (SmartfoxClient.Instance.IsYou(userId)) {
			AddCards(jsonData.GetString("cards"));
		} else {
			int numCards = jsonData.GetInt("numCards");

			for (int i = 0; i < numCards; i++) {
				hand.AddCard(new TLMBCard(-1));
			}
		}
	}
Exemplo n.º 23
0
 public void FromJson(JSONObject json)
 {
     Title           = json.GetString("Title");
     Url             = json.GetString("Url");
     Type            = json.GetString("Type");
     Enabled         = json.GetBoolean("Enabled");
     VoiceCommand    = json.GetString("VoiceCommand");
     UseTransparency = json.GetBoolean("UseTransparency");
     Height          = json.GetFloat("Height");
     Group           = json.GetString("Group");
     IconUrl         = json.GetString("IconUrl");
     Scale           = json.GetInt("Scale", 30);
     if (json.HasField("Refresh"))
     {
         Refresh = json.GetInt("Refresh");
     }
 }
Exemplo n.º 24
0
 public void FromJson(JSONObject json)
 {
     Title           = json.GetString("title");
     Url             = json.GetString("url");
     Type            = json.GetString("type");
     Enabled         = json.GetBoolean("enabled");
     VoiceCommand    = json.GetString("voiceCommand");
     UseTransparency = json.GetBoolean("useTransparency");
     Height          = json.GetFloat("height");
     Group           = json.GetString("group");
     IconUrl         = json.GetString("iconUrl");
     Scale           = json.GetInt("scale", 30);
     if (json.HasField("refresh"))
     {
         Refresh = json.GetInt("refresh");
     }
 }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     Window.SetFormat(Format.Rgba8888);
     SetContentView(Resource.Layout.Main);
     ConfigureToolbar();
     ConfigureListView();
     GetWaiterId();
     GetTables();
     #region Socket
     try
     {
         Socket.On("waiter", delegate(Object[] objects)
         {
             JSONObject msg = (JSONObject)objects[0];
             int id         = -1;
             int table      = -1;
             string status  = "";
             try
             {
                 id     = msg.GetInt("id");
                 status = msg.GetString("status");
                 table  = msg.GetInt("table");
             }
             catch (JSONException e)
             {
                 Console.WriteLine(e);
             }
             if (id == WaiterId)
             {
                 RunOnUiThread(() =>
                 {
                     GetTables();
                     Notification(table, status);
                 });
             }
         });
         Socket.Connect();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     #endregion
 }
Exemplo n.º 26
0
 void LoadLeaderboardDataSuccess(JSONObject data) {
   LeaderboardScreen.Tab selectedTab = (LeaderboardScreen.Tab)data.GetInt("type");
   LeaderboardScreen.SetData( data.GetArray("users"), selectedTab);
   Debug.Log("LoadLeaderboardDataSuccess " + data.ToString());
   if (ScreenManager.Instance.LeaderboardScreen != null) {
     ScreenManager.Instance.LeaderboardScreen.ShowTopPlayer(selectedTab);
   }
   PopupManager.Instance.CloseLoadingPopup();
 }
Exemplo n.º 27
0
    public void Init(JSONObject jsonData)
    {
        roomId = jsonData.GetString("roomId");
        userGames.Clear();
        JSONArray userGameArray = jsonData.GetArray("userGames");

        for (int i = 0; i < userGameArray.Length; i++)
        {
            userGames.Add(new TLMBGame(userGameArray[i].Obj));
        }

        droppedCards        = new TLMBCombination(jsonData.GetString("droppedCards"));
        roundDroppedCards   = new TLMBCombination(jsonData.GetString("roundDroppedCards"));
        activeUserSeatIndex = jsonData.GetInt("activeUserSeatIndex");
        state            = (State)jsonData.GetInt("state");
        gameConfig       = new TLMBGameConfig(jsonData.GetObject("gameConfig"));
        remainingSeconds = jsonData.GetInt("remainingSeconds");
    }
Exemplo n.º 28
0
  void LoadInboxDataSuccess(JSONObject data) {
    PopupManager.Instance.CloseLoadingPopup();
    ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
    if (errorCode == ErrorCode.USER.NULL) {
			if (PopupManager.Instance != null && PopupManager.Instance.PopupInbox != null) {
				PopupManager.Instance.PopupInbox.LoadInboxCallback(data.GetArray("inbox"));
			}
		}
  }
Exemplo n.º 29
0
        public static IList <ListBids> ShowBidsByUserId()
        {
            IList <ListBids> listBids1 = new List <ListBids> ();

            try
            {
                var JSON = new JSONArray(Get(ActionListBid));
                try {
                    for (int i = 0; i < JSON.Length(); i++)
                    {
                        JSONObject Cate     = JSON.GetJSONObject(i);
                        String     date     = Cate.GetString("date_on");
                        var        tempList = new ListBids();
                        tempList.ID         = Cate.GetInt("bids_id");
                        tempList.CateID     = Cate.GetInt("cate_id");
                        tempList.Date       = Cate.GetString("date_on");
                        tempList.Title      = Cate.GetString("title");
                        tempList.Text       = Cate.GetString("text");
                        tempList.DateUpd    = Cate.GetString("date_upd");
                        tempList.Type       = Cate.GetString("type");
                        tempList.Status     = Cate.GetString("status");
                        tempList.TimeFinish = Cate.GetString("time_finish");
                        tempList.Rating     = Cate.GetString("rating");
                        tempList.Telefone   = Cate.GetString("telephone");
                        tempList.Adress     = Cate.GetString("adress");
                        tempList.Name       = Cate.GetString("name");
                        listBids1.Add(tempList);
                    }
                } catch {
                    var temp1 = new ListBids();
                    temp1.Date  = DateTime.Now.ToLongDateString();
                    temp1.Title = "Ошибка параметров";
                    listBids1.Add(temp1);
                }
            } catch {
                var temp1 = new ListBids();
                temp1.Date  = DateTime.Now.ToLongDateString();
                temp1.Title = "Список пуст";
                listBids1.Add(temp1);
            }

            return(listBids1);
        }
Exemplo n.º 30
0
        public void FromJson(JSONObject json)
        {
            Name     = json.GetString("name");
            Lat      = json.GetFloat("lat");
            Lon      = json.GetFloat("lon");
            Zoom     = json.GetInt("zoom");
            Scale    = json.GetInt("scale");
            Range    = json.GetInt("range");
            TileSize = json.GetInt("tileSize");
            Layers   = new List <string>();
            if (json.HasField("layers"))
            {
                var ll = json["layers"];
                for (var l = 0; l < ll.Count; l++)
                {
                    Layers.Add(ll[l].str);
                }
            }
            ;

            TileLayers = new List <string>();
            if (json.HasField("tileLayers"))
            {
                var ll = json["tileLayers"];
                for (var l = 0; l < ll.Count; l++)
                {
                    TileLayers.Add(ll[l].str);
                }
            }
            ;

            Mapzen = new List <string>();
            if (json.HasField("mapzen"))
            {
                var ll = json["mapzen"];
                for (var l = 0; l < ll.Count; l++)
                {
                    Mapzen.Add(ll[l].str);
                }
            }
            ;
        }
Exemplo n.º 31
0
  void ClaimInboxRewardSuccess(JSONObject data) {
    PopupManager.Instance.CloseLoadingPopup();
    ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
    if (errorCode == ErrorCode.USER.NULL) {
			if (PopupManager.Instance != null && PopupManager.Instance.PopupInbox != null) {
				PopupManager.Instance.PopupInbox.ClaimRewardSuccess(data);
			}
		} else {
      HUDManager.Instance.AddFlyText(errorCode.ToString(), Vector3.zero, 40, Color.red);
		}
  }
Exemplo n.º 32
0
 void LoadLeaderboardDataSuccess(JSONObject data)
 {
     LeaderboardScreen.Tab selectedTab = (LeaderboardScreen.Tab)data.GetInt("type");
     LeaderboardScreen.SetData(data.GetArray("users"), selectedTab);
     Debug.Log("LoadLeaderboardDataSuccess " + data.ToString());
     if (ScreenManager.Instance.LeaderboardScreen != null)
     {
         ScreenManager.Instance.LeaderboardScreen.ShowTopPlayer(selectedTab);
     }
     PopupManager.Instance.CloseLoadingPopup();
 }
Exemplo n.º 33
0
        private async void SendData()
        {
            var dialog = new ProgressBarDialog("Va rugam asteptati", "Resetare...", this, false);

            dialog.Show();

            JSONObject dataToSent = new JSONObject().Put("email", _emailEditText.Text).Put("password", _passwordEditText.Text);
            string     res        = await WebServices.WebServices.Post(Constants.PublicServerAddress + "/api/passwordReset", dataToSent);

            if (res != null)
            {
                Log.Error("PwdResetActivity", res);

                try
                {
                    var response = new JSONObject(res);
                    Log.Error("Response", response.ToString());
                    switch (response.GetInt("status"))
                    {
                    case 0:
                        Snackbar.Make(_layout, "Email inexistent", Snackbar.LengthShort).Show();
                        break;

                    case 1:
                        Snackbar.Make(_layout, "Eroare de comunicare cu server-ul!", Snackbar.LengthShort).Show();
                        break;

                    case 2:
                        Snackbar.Make(_layout, "Un email de validare a fost trimis catre " + _emailEditText.Text, Snackbar.LengthShort).Show();
                        break;

                    default:
                        Snackbar.Make(_layout, "Eroare " + response, Snackbar.LengthShort).Show();
                        break;
                    }
                }
                catch (Exception e)
                {
                    var snack = Snackbar.Make(_layout, "Eroare " + e.Message, Snackbar.LengthShort);
                    snack.Show();
                }
            }
            else
            {
                Log.Error("PwdResetActivity", "res is null");
                var snack = Snackbar.Make(_layout, "Eroare preluare date de pe server", Snackbar.LengthShort);
                snack.Show();
            }

            RunOnUiThread(() =>
            {
                dialog.Dismiss();
            });
        }
Exemplo n.º 34
0
        protected void SetView(string msg)
        {
            var av    = appState.Config.ActiveView;
            var view  = new JSONObject(msg);
            var lat   = view.GetFloat("lat");
            var lon   = view.GetFloat("lon");
            var zoom  = view.GetInt("zoom");
            var range = view.GetInt("range", av.Range);

            if (av.Equal(lat, lon, zoom, range))
            {
                return;
            }
            av.SetView(lat, lon, zoom, range);
            if (!appState.TileManager)
            {
                return;
            }
            appState.ResetMap(av);
        }
Exemplo n.º 35
0
    // TO DO: update gem val
    public void ClaimRewardSuccess(JSONObject jsonData)
    {
        Debug.Log("ClaimRewardSuccess " + jsonData.ToString());
        AccountManager.Instance.UpdateUserCash(jsonData.GetInt("goldVal"));
        AccountManager.Instance.UpdateUserGem(jsonData.GetInt("gemVal"));
        JSONObject message;

        for (int i = 0; i < messageList.Length; i++)
        {
            message = messageList[i].Obj;
            if (message.GetLong("createdAt") == selectMessage.GetLong("createdAt") && message.GetInt("type") == selectMessage.GetInt("type") && (string.IsNullOrEmpty(selectMessage.GetString("fromUsername")) || message.GetString("fromUsername") == selectMessage.GetString("fromUsername")))
            {
                messageList.Remove(i);
                break;
            }
        }
        EventBackToListMessages();
        InitScrollViewData();
        HUDManager.Instance.AddFlyText(Localization.Get("PopupInbox_ClaimSuccess"), Vector3.zero, 40, Color.green);
    }
Exemplo n.º 36
0
 void LoadInboxDataSuccess(JSONObject data)
 {
     PopupManager.Instance.CloseLoadingPopup();
     ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
     if (errorCode == ErrorCode.USER.NULL)
     {
         if (PopupManager.Instance != null && PopupManager.Instance.PopupInbox != null)
         {
             PopupManager.Instance.PopupInbox.LoadInboxCallback(data.GetArray("inbox"));
         }
     }
 }
Exemplo n.º 37
0
 void AddFbFriendSuccess(JSONObject data)
 {
     ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
     if (errorCode == ErrorCode.USER.NULL)
     {
         Debug.Log("AddFbFriendSuccess--------- " + data.ToString());
     }
     else
     {
         HUDManager.Instance.AddFlyText(errorCode.ToString(), Vector3.zero, 40, Color.red);
     }
 }
Exemplo n.º 38
0
        private async Task _StartReceivingUdp(UdpClient udp)
        {
            var devices  = new List <Device>();
            var timespan = TimeSpan.FromSeconds(5);
            var datetime = DateTime.Now;
            var remoteEP = new IPEndPoint(IPAddress.Any, 11000);

            while (DateTime.Now <= datetime + timespan)
            {
                var asyncResult = udp.BeginReceive(null, null);
                asyncResult.AsyncWaitHandle.WaitOne(500);

                if (asyncResult.IsCompleted)
                {
                    try
                    {
                        var data = udp.EndReceive(asyncResult, ref remoteEP);
                        var json = System.Text.Encoding.UTF8.GetString(data);
                        var obj  = new JSONObject(json);

                        var ip   = obj.GetString("ipAddress");
                        var name = obj.GetString("name");
                        var port = obj.GetInt("port");

                        if (!devices.Any(x => x.IpAddress == ip))
                        {
                            devices.Add(new Device()
                            {
                                Name      = name,
                                IpAddress = ip,
                                Port      = port
                            });
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }


            RunOnUiThread(() =>
            {
                if (devices.Any())
                {
                    ((DeviceRowAdapter)_possibleListenerDevices.Adapter).AddAll(devices);
                }
            });

            udp.Close();
            udp.Dispose();
        }
Exemplo n.º 39
0
  public void DisplayUserInfo(JSONObject mUser) {
		Debug.Log("mUser " + mUser.ToString());
		Utils.SetActive(userInfoPanel, true);
    user = mUser;
    displayNameLabel.text = user.GetString("displayName");
    cashLabel.text = user.GetLong("cash").ToString("N0");
    killLabel.text = user.GetInt("bossKill").ToString("N0");
		avatarLink = user.GetString("avatar");
		if (avatarLink != string.Empty) {
			NGUITools.SetActive(avatarSprite.gameObject, true);
			NGUITools.SetActive(defaultAvatar, false);
			StartCoroutine(DisplayAvatar());
		} else {
			NGUITools.SetActive(avatarSprite.gameObject, false);
			NGUITools.SetActive(defaultAvatar, true);
		}
		Utils.SetActive(btnAddFriend.gameObject, !AccountManager.Instance.IsFriend(user.GetString("username")));
  }
Exemplo n.º 40
0
  public void SetResults(JSONObject jsonData) {
		spinDataResult = jsonData;
    resultsData = jsonData.GetArray("items");
    winningGold = jsonData.GetArray("wGold");
		// Calculate extra data (winning type, winning count from list result items)
		JSONObject extraData = SlotCombination.CalculateCombination(resultsData, GetNumLine());
    winningCount = extraData.GetArray("wCount");
    winningType = extraData.GetArray("wType");
		//
    isJackpot = jsonData.GetBoolean("isJP");
		freeSpinLeft = jsonData.GetInt("frLeft");
		isBigWin = jsonData.GetBoolean("bWin");
		gotFreeSpin = jsonData.GetInt("frCount") > 0;
		// bool[] winingItems = new bool[15];
		// for (int i = 0; i < winningGold.Length; i++) {
		// 	if (winningGold[i].Number > 0) {
		// 		for (int j = 0; j < SlotCombination.NUM_REELS; j++) {
		// 			winingItems[SlotCombination.COMBINATION[i, j]] = true;
		// 		}
		// 	}
		// }
    for (int i = 0; i < slotReels.Length; i++) {
      slotReels[i].SetResults(new int[3] { (int)resultsData[i * 3].Number, (int)resultsData[i * 3 + 1].Number, (int)resultsData[i * 3 + 2].Number });
    }
  }
Exemplo n.º 41
0
	public void Read( JSONObject obj )
	{
		X = obj.GetInt("x");
		Y = obj.GetInt("y");
	}
Exemplo n.º 42
0
	public TLMBGameConfig(JSONObject jsonData) {
		type = (Type)jsonData.GetInt("type");
		coinPerCard = jsonData.GetInt("coinPerCard");
		firstRankRewardCoin = jsonData.GetInt("firstRankRewardCoin");
		secondRankRewardCoin = jsonData.GetInt("secondRankRewardCoin");
	}
Exemplo n.º 43
0
 void AddFriendSuccess(JSONObject data) {
   ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
   if (errorCode == ErrorCode.USER.NULL) {
     string fUsername = data.GetString("fUsername");
     // AccountManager.Instance.friends.Add(fUsername);
     if (PopupManager.Instance.PopupUserInfo != null) {
       PopupManager.Instance.PopupUserInfo.AddFriendSuccess(fUsername);
     }
   } else {
     HUDManager.Instance.AddFlyText(errorCode.ToString(), Vector3.zero, 40, Color.red);
   }
 }
Exemplo n.º 44
0
		public override void Load(JSONObject obj)
		{
			TotalScore		= obj.GetInt("needScore");
		}
Exemplo n.º 45
0
 void AddFbFriendSuccess(JSONObject data) {
   ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
   if (errorCode == ErrorCode.USER.NULL) {
     Debug.Log("AddFbFriendSuccess--------- " + data.ToString());
   } else {
     HUDManager.Instance.AddFlyText(errorCode.ToString(), Vector3.zero, 40, Color.red);
   }
 }
Exemplo n.º 46
0
  void ClaimDailyRewardSuccess(JSONObject data) {
    ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
    if (errorCode == ErrorCode.USER.NULL) {
      Debug.Log("ClaimDailyRewardSuccess-- " + data.ToString());
			AccountManager.Instance.lastClaimedDaily = data.GetLong("lastDaily");
			AccountManager.Instance.UpdateUserCash(data.GetLong("cash"));
			if (ScreenManager.Instance.SelectGameScreen != null) {
				ScreenManager.Instance.SelectGameScreen.ClaimedDailyRewardCallback();
			}
    } else {
      Debug.Log("ClaimDailyRewardFail-- " + data.ToString());
      HUDManager.Instance.AddFlyText(errorCode.ToString(), Vector3.zero, 40, Color.red);
    }
  }
Exemplo n.º 47
0
	public void EventViewMessage(JSONObject message) {
		selectMessage = message;
		Utils.SetActive(scrollview.gameObject, false);
		Utils.SetActive(viewMessagePanel, true);
		Utils.SetActive(btnBack.gameObject, true);
		messageTitle.text = message.GetString("title");
		messageContent.text = message.GetString("message");
		int goldVal = message.GetInt("goldVal");
		int gemVal = message.GetInt("gemVal");
		if (goldVal <= 0 && gemVal <= 0) {
			Utils.SetActive(goldObject, false);
			Utils.SetActive(gemObject, false);
	    EventDelegate.Set(btnClaim.onClick, delegate() {});
			Utils.SetActive(btnClaim.gameObject, false);
		} else {
			Utils.SetActive(goldObject, goldVal > 0);
			Utils.SetActive(gemObject, gemVal > 0);
			goldLabel.text = goldVal.ToString("N0");
			gemLabel.text = gemVal.ToString("N0");
			rewardTable.Reposition();
			Utils.SetActive(btnClaim.gameObject, true);
	    EventDelegate.Set(btnClaim.onClick, delegate() { ClaimReward(message.GetInt("type"), message.GetLong("createdAt"), message.GetString("fromUsername")); });
		}
	}
	public SpinData(string username, JSONObject jsonData, bool isYou) {
		Debug.Log("SpinData: " + jsonData.ToString());
		this.isYou = isYou;
		this.username = username;
		JSONArray resultsData = jsonData.GetArray("items");
		JSONObject extraData = SlotCombination.CalculateCombination(resultsData, jsonData.GetInt("nL"));
	  JSONArray winningCount = extraData.GetArray("wCount");  
	  JSONArray winningType = extraData.GetArray("wType");
    JSONArray winningGold = jsonData.GetArray("wGold");
		
    for (int i = 0; i < winningGold.Length; i++) {
      totalDamage += (int)winningGold[i].Number;
    }
		
		if (jsonData.ContainsKey("newBoss")) {
			newBossData = jsonData.GetObject("newBoss");
			JSONArray bossDrops = jsonData.GetArray("dropItems");
			dropCash = (int)bossDrops[0].Number;
			dropGem = (int)bossDrops[1].Number;
			bossDrops = null;
			AccountManager.Instance.bossKilled++;
		}
		

		for (int i = 0; i < winningCount.Length; i++) {
			if (winningCount[i].Number >= 3 || ((int)winningType[i].Number == (int)SlotItem.Type.TILE_1 && winningCount[i].Number >= 2)) {
				spawnSkills.Add(new SpawnableSkill((int)winningType[i].Number, (int)winningCount[i].Number, (int)winningGold[i].Number, isYou));
			}
		}
		extraData = null;
		resultsData = null;
		winningCount = null;
		winningType = null;
		winningGold = null;
	}
	// Set result after receive from server, then slot reel will display result
  public virtual void SetResults(JSONObject jsonData) {
    slotMachine.SetResults(jsonData);
    // AccountManager.Instance.UpdateUserCash(-jsonData.GetInt("cost"));
    UpdateUserCashLabel(-jsonData.GetInt("cost"));
  }
Exemplo n.º 50
0
	// TO DO: update gem val
	public void ClaimRewardSuccess(JSONObject jsonData) {
		Debug.Log("ClaimRewardSuccess " + jsonData.ToString());
		AccountManager.Instance.UpdateUserCash(jsonData.GetInt("goldVal"));
		AccountManager.Instance.UpdateUserGem(jsonData.GetInt("gemVal"));
		JSONObject message;
		for (int i = 0; i < messageList.Length; i++) {
			message = messageList[i].Obj;
			if (message.GetLong("createdAt") == selectMessage.GetLong("createdAt") && message.GetInt("type") == selectMessage.GetInt("type") && (string.IsNullOrEmpty(selectMessage.GetString("fromUsername")) || message.GetString("fromUsername") == selectMessage.GetString("fromUsername"))) {
				messageList.Remove(i);
				break;
			}
		}
		EventBackToListMessages();
    InitScrollViewData();
    HUDManager.Instance.AddFlyText(Localization.Get("PopupInbox_ClaimSuccess"), Vector3.zero, 40, Color.green);
	}
  public override void Init(object[] data) {
    JSONObject jsonData = (JSONObject)data[1];

		InitPayouts(jsonData.GetString("payouts"));
		
		StopFreeSpinAnimation();
    EventDelegate.Set(btnBack.onClick, EventBackToSelectGame);
   	
   	slotMachine.Init(jsonData.GetString("betPerLines"));
    EventDelegate.Set(btnBetPerLine.onClick, EventBetPerLine);
    EventDelegate.Set(btnLines.onClick, EventBetLines);
    EventDelegate.Set(btnMaxBet.onClick, EventMaxBet);
    EventDelegate.Set(btnPayout.onClick, EventOpenPopupPayout);
		
    SetBetPerLine(DEFAULT_BET_PER_LINE_INDEX);
    SetNumbLine(1);
    
    // Init other players if have
    Debug.Log("### " + data[1].ToString());
    JSONArray otherPlayerDatas = jsonData.GetArray("otherPlayers");
		roomData = jsonData.GetObject("roomData");
    int count = 0;
    for (int i = 0; i < otherPlayerDatas.Length; i++) {
      if (!AccountManager.Instance.IsYou(otherPlayerDatas[i].Obj.GetString("username"))) {
        otherPlayers[count].Init(otherPlayerDatas[i].Obj.GetString("username"), otherPlayerDatas[i].Obj.GetString("displayName"), otherPlayerDatas[i].Obj.GetLong("cash"), otherPlayerDatas[i].Obj.GetString("avatar"));
        count++;
      }
    }
    
    for (int i = 0; i < otherPlayers.Length; i++) {
      if (otherPlayers[i].IsEmpty()) {
        otherPlayers[i].InitEmpty();
      }
    }
    
    roomId = jsonData.GetString("roomId");
    
    UpdateUserCashLabel(0);
		UpdateUserGemLabel(0);
		UpdateUserKillLabel();
    if (AccountManager.Instance.avatarLink != string.Empty) {
			Utils.SetActive(userAvatarTexture.gameObject, true);
			StartCoroutine(DisplayAvatar());
      // avatarSprite.spriteName = avatarName;
		} else {
			Utils.SetActive(userAvatarTexture.gameObject, false);
		}
    bigWinPanel.Hide();
		bossManager.Init(roomData.GetInt("dIndex"), roomData.GetInt("dHP"), roomData.GetInt("dMaxHP"), this, "BossGetHitCallback");
		
		if (Global.ENABLE_CHEAT) {
			Utils.SetActive(cheatPanel, true);
			// TEST CODE -- test skill
	    EventDelegate.Set(btnTestSkill.onClick, EventTestSkill);
	    // Set Bet Filter
	    for (int i = 1; i < 10; i++) {
	      btnTestSkillSelector.items.Add(i.ToString());
	    }
	    for (int i = 1; i <= 3; i++) {
	      btnTestSkillLevelSelector.items.Add(i.ToString());
	    }
	    for (int i = 0; i < 4; i++) {
	      btnTestSkillPosition.items.Add(i.ToString());
	    }
			
		} else {
			Utils.SetActive(cheatPanel, false);
		}

		HideWinningLinesDisplay();
    base.Init(data);
  }
Exemplo n.º 52
0
			public void Read(JSONObject obj)
			{
				pos = new Point();
				pos.Read(obj);
				level = obj.GetInt("level");
			}