Exemple #1
0
        public bool Get_Friend_Battary(int v_user_id, int dorm_id, int num)
        {
            System.Threading.Thread.Sleep(5000);
            string outdatacode = "{\"v_user_id\":" + v_user_id.ToString() + "," + "\"dorm_id\":" + dorm_id.ToString() + "}";

            outdatacode = AuthCode.Encode(outdatacode, ProgrameData.sign);
            string requeststring = String.Format("uid={0}&outdatacode={1}&req_id={2}", ProgrameData.uid, System.Web.HttpUtility.UrlEncode(outdatacode), ProgrameData.req_id++.ToString());

            string result = "";

            while (string.IsNullOrEmpty(result) == true)
            {
                result = DoPost(ProgrameData.GameAdd + RequestUrls.Get_Friend_Build_Coin, requeststring);
            }
            //var jsonobj = DynamicJson.Parse(AuthCode.Decode(result, ProgrameData.sign));
            //result = CommonHelp.DecodeAndMapJson(result);
            var jsonobj = DynamicJson.Parse(CommonHelp.DecodeAndMapJson(result));

            try
            {
                //如果和预想的num一样则返回true
                if (Convert.ToInt32(jsonobj.build_coin) == num)
                {
                    return(true);
                }
                else
                {
                    //一些报错处理
                    return(false);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("获取好友电池出错");
                MessageBox.Show(e.ToString());
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 后勤控件处理 梯队 任务 框 和按钮
        /// </summary>
        public void setUI_User_info()//每一秒刷新一次
        {
            im.mainWindow.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
                                                () =>
            {
                setUserInfo();

                im.mainWindow.Battle_Task1_LOOPTIME.Content = im.dic_userbattletaskinfo[0].LoopTime.ToString();
                //基础动能超导动能
                im.mainWindow.textBPnum.Text     = im.userdatasummery.user_info.bp.ToString();
                im.mainWindow.textBP_PayNUM.Text = im.userdatasummery.user_info.bp_pay.ToString();
                //动能点数倒数时间
                SetBPTime_Recover();
                SetBattleReportTime();

                for (int k = 0; k < 4; k++)
                {
                    switch (k)
                    {
                    case 0:
                        {
                            im.mainWindow.comboBoxOperationTeam1.SelectedIndex = im.Dic_auto_operation_act[k].team_id - 1;
                            im.mainWindow.comboBoxOperation1.SelectedIndex     = im.Dic_auto_operation_act[k].operation_id - 1;
                            if (im.Dic_auto_operation_act[k].remaining_time <= 0)
                            {
                                im.mainWindow.operation_time1.Text             = "   完成";
                                im.mainWindow.AutoOperationB_S1.Content        = "任务开始";
                                im.mainWindow.comboBoxOperationTeam1.IsEnabled = true;
                                im.mainWindow.comboBoxOperation1.IsEnabled     = true;
                            }
                            else
                            {
                                im.mainWindow.operation_time1.Text = CommonHelp.formatDuration(Convert.ToInt32(im.Dic_auto_operation_act[k].remaining_time));

                                im.mainWindow.comboBoxOperationTeam1.IsEnabled = false;
                                im.mainWindow.comboBoxOperation1.IsEnabled     = false;
                                im.mainWindow.AutoOperationB_S1.Content        = "任务终止";
                            }


                            break;
                        }

                    case 1:
                        {
                            im.mainWindow.comboBoxOperationTeam2.SelectedIndex = im.Dic_auto_operation_act[k].team_id - 1;
                            im.mainWindow.comboBoxOperation2.SelectedIndex     = im.Dic_auto_operation_act[k].operation_id - 1;
                            if (im.Dic_auto_operation_act[k].remaining_time <= 0)
                            {
                                im.mainWindow.operation_time2.Text             = "   完成";
                                im.mainWindow.AutoOperationB_S2.Content        = "任务开始";
                                im.mainWindow.comboBoxOperationTeam2.IsEnabled = true;
                                im.mainWindow.comboBoxOperation2.IsEnabled     = true;
                            }
                            else
                            {
                                im.mainWindow.operation_time2.Text             = CommonHelp.formatDuration(Convert.ToInt32(im.Dic_auto_operation_act[k].remaining_time));
                                im.mainWindow.AutoOperationB_S2.Content        = "任务终止";
                                im.mainWindow.comboBoxOperationTeam2.IsEnabled = false;
                                im.mainWindow.comboBoxOperation2.IsEnabled     = false;
                            }

                            break;
                        }

                    case 2:
                        {
                            im.mainWindow.comboBoxOperationTeam3.SelectedIndex = im.Dic_auto_operation_act[k].team_id - 1;
                            im.mainWindow.comboBoxOperation3.SelectedIndex     = im.Dic_auto_operation_act[k].operation_id - 1;
                            if (im.Dic_auto_operation_act[k].remaining_time <= 0)
                            {
                                im.mainWindow.operation_time3.Text             = "   完成";
                                im.mainWindow.AutoOperationB_S3.Content        = "任务开始";
                                im.mainWindow.comboBoxOperationTeam3.IsEnabled = true;
                                im.mainWindow.comboBoxOperation3.IsEnabled     = true;
                            }
                            else
                            {
                                im.mainWindow.AutoOperationB_S3.Content        = "任务终止";
                                im.mainWindow.comboBoxOperationTeam3.IsEnabled = false;
                                im.mainWindow.comboBoxOperation3.IsEnabled     = false;
                                im.mainWindow.operation_time3.Text             = CommonHelp.formatDuration(Convert.ToInt32(im.Dic_auto_operation_act[k].remaining_time));
                            }

                            break;
                        }

                    case 3:
                        {
                            im.mainWindow.comboBoxOperationTeam4.SelectedIndex = im.Dic_auto_operation_act[k].team_id - 1;
                            im.mainWindow.comboBoxOperation4.SelectedIndex     = im.Dic_auto_operation_act[k].operation_id - 1;

                            if (im.Dic_auto_operation_act[k].remaining_time <= 0)
                            {
                                im.mainWindow.operation_time4.Text             = "   完成";
                                im.mainWindow.AutoOperationB_S4.Content        = "任务开始";
                                im.mainWindow.comboBoxOperationTeam4.IsEnabled = true;
                                im.mainWindow.comboBoxOperation4.IsEnabled     = true;
                            }
                            else
                            {
                                im.mainWindow.operation_time4.Text             = CommonHelp.formatDuration(Convert.ToInt32(im.Dic_auto_operation_act[k].remaining_time));
                                im.mainWindow.AutoOperationB_S4.Content        = "任务终止";
                                im.mainWindow.comboBoxOperationTeam4.IsEnabled = false;
                                im.mainWindow.comboBoxOperation4.IsEnabled     = false;
                            }

                            break;
                        }

                    default:
                        break;
                    }
                }

                if (im.mainWindow.AutoOperation_CheckBox.IsChecked == false)
                {
                    im.mainWindow.AutoOperationB_S1.IsEnabled = true;
                    im.mainWindow.AutoOperationB_S2.IsEnabled = true;
                    im.mainWindow.AutoOperationB_S3.IsEnabled = true;
                    im.mainWindow.AutoOperationB_S4.IsEnabled = true;
                }
                else
                {
                    im.mainWindow.AutoOperationB_S1.IsEnabled = false;
                    im.mainWindow.AutoOperationB_S2.IsEnabled = false;
                    im.mainWindow.AutoOperationB_S3.IsEnabled = false;
                    im.mainWindow.AutoOperationB_S4.IsEnabled = false;
                }
                im.uihelp.MainWindowTitle();
            }
                                                )
                                            );
        }