Beispiel #1
0
        // ==============================================
        // ===== Initializer
        // ==============================================
        #region Initializer

        /// <summary>
        /// 생성자
        /// </summary>
        /// <param name="id"></param>
        public EchelonTemplate(DollWithUserInfo doll)
        {
            this.gunWithUserId = doll.id;
            this.teamId        = doll.team;
            this.location      = doll.location;
            Refresh();
        }
Beispiel #2
0
        /// <summary>
        /// 인형 스킬훈련 완료
        /// ("Gun/finishUpgrade")
        /// ("Gun/quickUpgrade")
        /// </summary>
        /// <param name="request_string"></param>
        /// <param name="response_string"></param>
        public static void FinishSkillTrain(string request_string, string response_string)
        {
            #region Packet Example
            // request

            /*
             *  {
             *      "upgrade_slot": 1
             *  }
             */
            #endregion
            try
            {
                log.Debug("인형 스킬훈련 완료");
                JObject request = Parser.Json.ParseJObject(request_string);
                if (request != null)
                {
                    int upgradeSlot             = Parser.Json.ParseInt(request["upgrade_slot"]);
                    SkillTrainTemplate template = dashboardView.GetSlotSkillTrain(upgradeSlot);
                    if (template != null && template.gunWithUserId > 0)
                    {
                        long             id   = template.gunWithUserId;
                        DollWithUserInfo doll = UserData.Doll.Get(id);
                        if (doll != null)
                        {
                            if (template.skill == 1)
                            {
                                doll.skill1 = template.toSkillLevel;
                            }
                            else if (template.skill == 2)
                            {
                                doll.skill2 = template.toSkillLevel;
                            }
                            UserData.Doll.Set(doll);
                        }
                    }

                    // 알림 탭 제거
                    dashboardView.Remove(template);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex, "failed to get Gun/finishUpgrade");
            }
        }
Beispiel #3
0
        /// <summary>
        /// 군수지원 시작
        /// ("Operation/startOperation")
        /// </summary>
        /// <param name="packet"></param>
        public static void StartOperation(string request_string, string response_string)
        {
            #region Packet Example
            // request Operation/startOperation?uid={0}&outdatacode={1}&req_id={2}

            /*
             *  {
             *      "team_id": 8,
             *      "operation_id": 29,
             *      "max_level": 120
             *  }
             */
            #endregion
            try
            {
                log.Debug("군수지원 시작");
                JObject request = Parser.Json.ParseJObject(request_string);
                if (request != null)
                {
                    int teamId = Parser.Json.ParseInt(request["team_id"]);
                    log.Debug("투입 제대 {0}", teamId);
                    if (Util.Common.IsValidTeamId(teamId))
                    {
                        int operationId = Parser.Json.ParseInt(request["operation_id"]);
                        int maxLevel    = Parser.Json.ParseInt(request["max_level"]);
                        int startTime   = TimeUtil.GetCurrentSec();
                        log.Debug("군수번호 {0}", operationId);
                        log.Debug("최대 레벨 {0}", maxLevel);

                        // 제대 리더
                        long gunWithUserId = UserData.Doll.GetTeamLeaderGunWithUserId(teamId);
                        int  gunId         = 0;
                        int  skinId        = 0;
                        if (gunWithUserId > 0)
                        {
                            DollWithUserInfo doll = UserData.Doll.Get(gunWithUserId);
                            if (doll != null)
                            {
                                gunId  = doll.no;
                                skinId = doll.skin;
                                log.Debug("리더 {0} {1}", gunWithUserId, doll.name);
                            }
                        }

                        // 음성 알림
                        Notifier.Manager.notifyQueue.Enqueue(new Message()
                        {
                            send   = MessageSend.Voice,
                            type   = MessageType.start_operation,
                            gunId  = gunId,
                            skinId = skinId,
                        });

                        // 알림 탭 추가

                        dashboardView.Add(new DispatchedEchleonTemplate()
                        {
                            operationId = operationId,
                            teamId      = teamId,
                            startTime   = startTime,
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex, "failed to get Operation/startOperation");
            }
        }
Beispiel #4
0
        /// <summary>
        /// 자율작전 시작
        /// </summary>
        /// <param name="request_string"></param>
        /// <param name="response_string"></param>
        public static void StartAutomission(string request_string, string response_string)
        {
            #region Packet Example
            // request Automission/startAutomission?uid={0}&outdatacode={1}&req_id={2}

            /*
             *  {
             *      "team_ids": [1,6],
             *      "auto_mission_id": 114,
             *      "number": 1
             *  }
             */
            #endregion
            try
            {
                log.Debug("자율작전 시작");
                JObject request = Parser.Json.ParseJObject(request_string);
                if (request != null)
                {
                    int   autoMissionId = Parser.Json.ParseInt(request["auto_mission_id"]);
                    int[] teamIds       = Parser.Json.ParseIntArray(request["team_ids"]).ToArray();
                    int   teamId        = teamIds[0];
                    int   number        = Parser.Json.ParseInt(request["number"]);
                    int   startTime     = TimeUtil.GetCurrentSec();
                    //long startTime = Parser.Time.GetCurrentMs();

                    log.Debug("작전번호 {0}", autoMissionId);
                    log.Debug("작전횟수 {0}", number);

                    // 제대 리더
                    long             gunWithUserId = UserData.Doll.GetTeamLeaderGunWithUserId(teamIds[0]);
                    DollWithUserInfo doll = UserData.Doll.Get(gunWithUserId);
                    int gunId = 0, skinId = 0;
                    if (doll != null)
                    {
                        gunId  = doll.no;
                        skinId = doll.skin;
                        log.Debug("리더 {0} {1}", gunWithUserId, doll.name);
                    }

                    // 음성 알림
                    Notifier.Manager.notifyQueue.Enqueue(new Message()
                    {
                        send   = MessageSend.Voice,
                        type   = MessageType.start_auto_mission,
                        gunId  = gunId,
                        skinId = skinId,
                    });

                    dashboardView.Add(new DispatchedEchleonTemplate()
                    {
                        autoMissionNumber = number,
                        autoMissionId     = autoMissionId,
                        teamIds           = teamIds,
                        startTime         = startTime,
                    });
                }
            }
            catch (Exception ex)
            {
                log.Error(ex, "자율작전 시작 에러");
            }
        }
Beispiel #5
0
        // ==============================================
        // ===== Function
        // ==============================================
        #region Function

        /// <summary>
        /// 새로고침
        /// </summary>
        /// <param name="refresh"></param>
        public void Refresh(bool forceUpdate = false)
        {
            if (this.gunWithUserId > 0)
            {
                DollWithUserInfo data = UserData.Doll.Get(this.gunWithUserId);
                if (data != null)
                {
                    data.Refresh(DollWithUserInfo.REFRESH.ALL, forceUpdate);
                    this.assign    = data.location == 1 ? "LEADER" : "";
                    this.location  = data.location;
                    this.star      = data.star;
                    this.collabo   = data.collabo;
                    this.level     = data.level;
                    this.maxLevel  = data.maxLevel;
                    this.number    = data.link.ToString();
                    this.maxNumber = data.maxLink.ToString();
                    this.name      = data.name;
                    if (data.remainExp == 0 && data.level == data.maxLevel)
                    {
                        this.remainExp = "MAX";
                    }
                    else
                    {
                        this.remainExp = data.remainExp.ToString();
                    }
                    this.type        = data.type;
                    this.hp          = data.hp.ToString();
                    this.maxHp       = data.maxHp.ToString();
                    this.TBHpWarning = data.hpWarningLevel.ToString();

                    this.hpHeight  = (double)data.hp / (double)data.maxHp * this.maxHpHeight;
                    this.expHeight = (double)data.currentExp / (double)data.maxExp * this.maxExpHeight;

                    this.typeIcon = GetTypeIcon(this.type, "", this.star, this.collabo);

                    this.supply[0] = data.ammo;
                    this.supply[1] = data.mre;
                    OnPropertyChanged("supply");

                    this.runCount = data.runCount;
                    OnPropertyChanged("runCount");
                    this.reportCount = data.reportCount;
                    OnPropertyChanged("reportCount");

                    int[] restore = data.restore;
                    if (restore.Length == 3)
                    {
                        this.TBRestoreRequireTime     = TimeUtil.GetRemainHHMMSS(data.restore[0] + TimeUtil.GetCurrentSec());
                        this.TBRestoreRequireManpower = restore[1].ToString();
                        this.TBRestoreRequirePart     = restore[2].ToString();
                    }
                    OnPropertyChanged("TBRestoreRequireTime");
                    OnPropertyChanged("TBRestoreRequireManpower");
                    OnPropertyChanged("TBRestoreRequirePart");
                }
                else
                {
                    log.Warn("인형 정보가 존재하지 않음 {0}", this.gunWithUserId);
                }
            }
            else if (this.fairyWithUserId > 0)
            {
                FairyWithUserInfo data = UserData.Fairy.Get(this.fairyWithUserId);
                if (data != null)
                {
                    this.type      = "FAIRY";
                    this.fairyType = data.category;
                    this.location  = 6;
                    this.level     = data.level;
                    this.maxLevel  = data.maxLevel;
                    this.name      = data.name;
                    if (data.remainExp == 0 && data.level == data.maxLevel)
                    {
                        this.remainExp = "MAX";
                    }
                    else
                    {
                        this.remainExp = data.remainExp.ToString();
                    }
                    this.fairyTrait  = data.traitName;
                    this.isRareTrait = data.isRareTrait.ToString();

                    this.expHeight = (double)data.currentExp / (double)data.maxExp * this.maxExpHeight;

                    this.typeIcon = GetTypeIcon(this.type, this.fairyType, 0, false);

                    data.Refresh(FairyWithUserInfo.REFRESH.CHANGE_TEAM_EXP);

                    if (data.remainExp == 0)
                    {
                        this.runCount    = new long[] { 0, 0, 0 };
                        this.reportCount = new long[] { 0, 0, 0 };
                    }
                    else
                    {
                        this.runCount    = data.runCount;
                        this.reportCount = data.reportCount;
                    }

                    this.TBRestoreRequireTime = "00:00:00";
                    OnPropertyChanged("TBRestoreRequireTime");
                }
                else
                {
                    log.Warn("요정 정보가 존재하지 않음 {0}", this.fairyWithUserId);
                }
            }
        }