예제 #1
0
파일: Rank.cs 프로젝트: XUWENJIExwj/SkyJump
    public void SortRank()
    {
        RankInfo temp = newRank;

        bool hasGetRank = false;

        for (int i = 0; i < rankInfo.Length; i++)
        {
            if (rankInfo[i].score < temp.score)
            {
                RankInfo work = rankInfo[i];

                rankInfo[i].rank  = i + 1;
                rankInfo[i].name  = temp.name;
                rankInfo[i].score = temp.score;

                if (!hasGetRank)
                {
                    hasGetRank   = true;
                    newRank.rank = rankInfo[i].rank;
                }

                temp = work;

                SaveRank(i);
            }
        }
        PlayerPrefs.Save();
    }
예제 #2
0
    private void OnLogout()
    {
        toggle_login.isOn = false;

        // reset myBestRankInfo
        MainMenu.myRankInfo = null;
    }
예제 #3
0
        public async Task <bool> SaveLastRankInfoAsync(RankInfo rankInfo)
        {
            try
            {
                // Get the current RankInfo list
                List <RankInfo> rankInfoList = await GetRankInfoListAsync();

                // Check if it's already in the list
                RankInfo lastRankInfo = rankInfoList.FirstOrDefault(r => r.SteamId == rankInfo.SteamId);
                if (lastRankInfo != null)
                {
                    // Known account, update it
                    rankInfoList.Remove(lastRankInfo);
                    rankInfoList.Add(rankInfo);
                }
                else
                {
                    // New account, add it
                    rankInfoList.Add(rankInfo);
                }

                string json = await Task.Factory.StartNew(() => JsonConvert.SerializeObject(rankInfoList));

                string pathWhitelistFileJson = _pathFolderCache + Path.DirectorySeparatorChar + RANKS_FILENAME;
                File.WriteAllText(pathWhitelistFileJson, json);
            }
            catch (Exception e)
            {
                Logger.Instance.Log(e);
                throw;
            }

            return(true);
        }
예제 #4
0
 public void SetGameOver()
 {
     RankInfo.SetNewRankInfo("Player", score.GetScore());
     fade.SetFadeState(Fade.FadeState.FADE_STATE_OUT);
     fade.FadeOut();
     AudioManager.PlaySE(AudioManager.AudioSourceIndex.AUDIO_SOURCE_SE_TYPE_A, AudioManager.SE.SE_GAME_OVER, 0.2f);
 }
예제 #5
0
        public List <KFRankData> FilterRankTopList(List <KFRankData> _RankTopList, RankInfo info)
        {
            List <KFRankData> result;

            if (_RankTopList.Count <= info.RankRoleCount)
            {
                result = _RankTopList;
            }
            else
            {
                List <KFRankData> RankTopListFilter = new List <KFRankData>();
                for (int index = 0; index < _RankTopList.Count; index++)
                {
                    if (index < info.RankRoleCount)
                    {
                        RankTopListFilter.Add(_RankTopList[index]);
                    }
                    else
                    {
                        KFRankData rankinfo = new KFRankData();
                        rankinfo.Clone(_RankTopList[index]);
                        rankinfo.RoleData = null;
                        RankTopListFilter.Add(rankinfo);
                    }
                }
                result = RankTopListFilter;
            }
            return(result);
        }
예제 #6
0
        public async Task <bool> UpdateRankInfoAsync(Demo demo, long steamId)
        {
            // We don't care about no valve demos
            if (demo.SourceName != "valve" || steamId == 0)
            {
                return(false);
            }
            // Check if the player is in the demo
            Player player = demo.Players.FirstOrDefault(p => p.SteamId == steamId);

            if (player == null)
            {
                return(false);
            }
            // Don't update if demo's date is higher than the known last rank date detected
            RankInfo lastRankInfo = await GetLastRankInfoAsync(steamId);

            if (lastRankInfo != null && lastRankInfo.LastDate > demo.Date)
            {
                return(false);
            }
            lastRankInfo = new RankInfo
            {
                SteamId  = player.SteamId,
                Number   = player.RankNumberNew,
                LastDate = demo.Date
            };
            await SaveLastRankInfoAsync(lastRankInfo);

            return(true);
        }
예제 #7
0
 private void LoadScoreInfo()
 {
     //score.SetScore(0);
     //scoreBest.SetScore(0);
     score.SetScore(RankInfo.GetNewRankInfo().score);
     scoreBest.SetScore(RankInfo.GetRankInfo(0).score);
 }
예제 #8
0
파일: RankMgr.cs 프로젝트: mengtest/Ripping
 private void FillChangeRankInfo()
 {
     while (rankInfos.Count < rankDic.Count && rankInfos.Count < RANK_NUM)
     {
         // 补足排名
         RankInfo max = new RankInfo();
         max.rank = -1;
         foreach (RankInfo info in rankDic.Values)
         {
             if (rankKey.ContainsKey(info.id))
             {
                 continue;
             }
             if (max.rank == -1)
             {
                 max = info;
             }
             if (max.score < info.score)
             {
                 max = info;
             }
         }
         if (max.rank == -1)
         {
             break;
         }
         max.rank       = rankInfos.Count;
         max.modifyType = 1;
         rankInfos.Add(max);
         rankKey.Add(max.id, true);
     }
 }
예제 #9
0
        public RankInfo RankGet(int portalId, int moduleId, int rankId)
        {
            Modules.Forums.Components.Controllers.ForumsController fc = new Modules.Forums.Components.Controllers.ForumsController();
            RankInfo ri = fc.GetRank(rankId);

            return(ri);
        }
예제 #10
0
    private bool LoadRankData()
    {
        if (File.Exists(Application.persistentDataPath + "/" + rankInfoFileName))
        {
            try
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(Application.persistentDataPath + "/" + rankInfoFileName, FileMode.Open);
                RankInfo        data = (RankInfo)bf.Deserialize(file);
                rankData = data;
                file.Close();
            }
            catch
            {
                return(false);
            }

            //if (EventList.TwitchUserLoadedFromFile != null)
            //{
            //    EventList.TwitchUserLoadedFromFile(userData);
            //}

            return(true);
        }

        return(false);
    }
예제 #11
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this.gameObject;
        }
        else
        {
            Debug.LogError("There were two GameData objects and there can only be one. Deleting the second one.");
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(instance);

        if (LoadRankData() == false)
        {
            rankData = new RankInfo();
            SaveRankData();
        }

        EventList.TwitchUserLogOut += OnTwitchUserLogout;
        EventList.MissionCompleted += MissionCompletedHandler;
        EventList.RankChange       += RankPromotionHandler;
    }
예제 #12
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            UpdateEmployee.grant_type   = "password";
            UpdateEmployee.empNm        = txtEmployeeName.Text;
            UpdateEmployee.empEngNm     = txtEmployeeEngName.Text;
            UpdateEmployee.rank         = RankInfo.Where(o => o.rankName.Equals(cboRank.Text)).First();
            UpdateEmployee.empFlag      = cboEmployeeType.SelectedItem.ToString();
            UpdateEmployee.team         = cboTeamName.SelectedItem.ToString();
            UpdateEmployee.email        = txtEmailFirst + "@" + cboEmailAddr.SelectedItem.ToString();
            UpdateEmployee.empTel       = txtEmployeeTel.Text;
            UpdateEmployee.empHp        = txtEmployeeHtel.Text;
            UpdateEmployee.project      = ProjectInfo.Where(o => o.prjNm.Equals(cboProject.Text)).First();
            UpdateEmployee.maritalState = cboEmployeeMaritalState.SelectedItem.ToString() != "기혼" ? "false" : "true";
            UpdateEmployee.birthState   = cboEmployeeBrithState.SelectedItem.ToString();
            UpdateEmployee.updateDate   = DateTime.Now.ToUniversalTime().ToString("s") + "Z";;
            UpdateEmployee.enteringDate = employeeEnteringDate.Value.ToUniversalTime().ToString("s") + "Z";
            UpdateEmployee.birthDate    = employeeBirthDate.Value.ToUniversalTime().ToString("s") + "Z";
            UpdateEmployee.maritalDate  = employeeMarital_date.Value.ToUniversalTime().ToString("s") + "Z";
            UpdateEmployee.leaveDate    = cboEmployeeLeaveType.SelectedItem.ToString() != "퇴사" ? employeeLeaveDate.Value.ToUniversalTime().ToString("s") + "Z" : " ";

            ANBTX.Update("/api/employee", UpdateEmployee);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
예제 #13
0
        private void SendOverRankInfo()
        {
            stPkgHead head = new stPkgHead();

            head.iSytle = 80;
            RankInfo[] info   = new RankInfo[ships.Length];
            byte[]     buffer = new byte[ships.Length * RankInfo.TotolLength];

            for (int i = 0; i < ships.Length; i++)
            {
                info[i].Score = ships[i].Score;
                info[i].Rank  = 0;
                info[i].Name  = new char[RankInfo.NameLength];

                for (int j = 0; j < ships[i].PlayerName.Length; j++)
                {
                    info[i].Name[j] = ships[i].PlayerName[j];
                }

                byte[] temp = SocketMgr.StructToBytes(info[i]);
                temp.CopyTo(buffer, i * RankInfo.TotolLength);
            }

            MemoryStream stream = new MemoryStream();

            stream.Write(buffer, 0, buffer.Length);
            head.dataSize = buffer.Length;

            SocketMgr.SendCommonPackge(head, stream);
            stream.Close();
        }
예제 #14
0
        public async Task GetNextRaider()
        {
            List <User>       users      = _db.Users.ToList().Where(x => x.IsStreaming).ToList();
            List <IGuildUser> guildUsers = new List <IGuildUser>();

            IGuild guild = Context.Guild;

            foreach (var u in users)
            {
                IGuildUser guildUser = await guild.GetUserAsync(u.GetID());

                if (Globals.AlreadyRaided.Contains(guildUser))
                {
                    continue;
                }
                RankInfo ri = _db.Ranks.Find(u.CurrentRank);

                for (int i = 0; i < ri.RaidWeighting; i++)
                {
                    guildUsers.Add(guildUser);
                }
            }

            Random r   = new Random();
            int    idx = r.Next(0, guildUsers.Count);

            IGuildUser nextRaid = guildUsers[idx];

            await Context.Channel.SendMessageAsync($"Next raid has been decided! We'll be heading to user: {nextRaid.Mention}'s channel!").ConfigureAwait(false);

            _log.Info($"Had {guildUsers.Count} entries. Selected index {idx}");
            Globals.AlreadyRaided.Add(nextRaid);
        }
예제 #15
0
    public void InputNameOK()
    {
        int idx = RankInfo.GetNewRankInfo().rank - 1;

        bool all_blank = true;

        for (int i = 0; i < inputer.textComponent.text.Length; i++)
        {
            if (inputer.textComponent.text[i] != 0x20)
            {
                all_blank = false;
                break;
            }
        }

        if (!all_blank)
        {
            RankInfo.InputRankName(inputer.textComponent.text, idx);
        }

        checkStringByte.MakeCharacterToLimit(RankInfo.GetRankInfo(idx).name);
        RankInfo.SaveRank(idx);

        AudioManager.PlaySE(AudioManager.AudioSourceIndex.AUDIO_SOURCE_SE_TYPE_A, AudioManager.SE.SE_TITLE, 0.5f);
        inputer.gameObject.SetActive(false);
    }
예제 #16
0
파일: RankMgr.cs 프로젝트: mengtest/Ripping
    private void OnScoreRefresh(string gameEvent, NetworkInstanceId id)
    {
        GameObject go = NetworkServer.FindLocalObject(id);

        if (go == null)
        {
            return;
        }
        TestController player = go.GetComponent <TestController>();

        if (player == null)
        {
            return;
        }
        RankInfo rankInfo;

        if (!rankDic.ContainsKey(id.Value))
        {
            rankInfo       = new RankInfo();
            rankInfo.id    = id.Value;
            rankInfo.name  = player.playerName;
            rankInfo.score = player.score;
            rankInfo.rank  = 0;
            rankDic.Add(rankInfo.id, rankInfo);
        }
        else
        {
            rankInfo       = rankDic[id.Value];
            rankInfo.score = player.score;
            rankInfo.name  = player.playerName;
        }
        CheckChange(rankInfo);
    }
예제 #17
0
        public RankInfo GetRankById(uint ranktype)//根据大类Id取内容
        {
            List <Dictionary <string, string> > data_rank = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "data_rank", "parent_id", ranktype.ToString());
            RankInfo info = new RankInfo();

            foreach (var randInfo in data_rank)
            {
                uint childId = DBTextResource.ParseUI(randInfo["child_id"]);
                info.Ids.Add(childId);
                info.Name = randInfo["name"];
                string subName = randInfo["sub_name"];
                info.SubNames.Add(subName);
                List <string> marks    = new  List <string>();
                string        subMarks = randInfo["sub_mark"];
                subMarks = subMarks.Replace(" ", "");
                subMarks = subMarks.Substring(1, subMarks.Length - 2);
                var str = subMarks.Split(',');
                for (int i = 0; i < str.Length; i++)
                {
                    marks.Add(str[i]);
                }
                if (info.SubMarks.ContainsKey(childId) == false)
                {
                    info.SubMarks.Add(childId, marks);
                }
            }

            return(info);
        }
예제 #18
0
    private List <RankInfo> ReadRankInfo(string path)
    {
        FileInfo rankInfo = new FileInfo(path);

        if (!rankInfo.Exists)
        {
            return(null);
        }

        StreamReader sr = null;

        sr = rankInfo.OpenText();
        List <RankInfo> ranks = new List <RankInfo>();
        string          line  = sr.ReadLine();

        while (line != null)
        {
            string[] words = line.Split(',');
            RankInfo rank  = new RankInfo(int.Parse(words[0]), float.Parse(words[1]));
            ranks.Add(rank);
            line = sr.ReadLine();
        }
        sr.Close();
        sr.Dispose();
        return(ranks);
    }
예제 #19
0
파일: RoleRank.cs 프로젝트: Pircs/Fishing-1
    private bool LoadRoleRankXml(bool IsError = false)
    {
        if (IsError)
        {
            m_IsLoadXmlInfo = true;
            RankXmlMap.Clear();               //清空数据
            tagRankXmlChangeEvent pEvent = new tagRankXmlChangeEvent();
            MsgEventHandle.HandleMsg(pEvent); //添加排行榜XML文件读取成功的函数
            return(true);
        }
        //读取配置文件 并且加载到数据集合里面去
        DateTime time     = SystemTime.Instance.GetSystemDateTime;
        UInt32   WriteSec = FishConfig.Instance.GetWriteSec();

        time = time.AddSeconds(WriteSec * -1);
        string FileName = string.Format("Rank_{0}_{1}_{2}.xml", time.Year, time.Month, time.Day);

        Byte[]      FileText = RuntimeInfo.GetLocalFile(FileName);
        XmlDocument doc      = new XmlDocument();

        doc.LoadXml(System.Text.Encoding.UTF8.GetString(FileText));
        XmlElement pRankConfig = doc.DocumentElement;

        for (int i = 0; i < doc.ChildNodes.Count; ++i)
        {
            if (doc.ChildNodes[i].Name == "FishRanks")
            {
                for (int k = 0; k < doc.ChildNodes[i].ChildNodes.Count; ++k)
                {
                    if (doc.ChildNodes[i].ChildNodes[k].Name == "FishRook")
                    {
                        RankInfo pRankInfo = new RankInfo();
                        pRankInfo.RankID = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].Attributes["TypeID"].Value);

                        for (int j = 0; j < doc.ChildNodes[i].ChildNodes[k].ChildNodes.Count; ++j)
                        {
                            if (doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Name == "Info")
                            {
                                tagRankInfo pInfo = new tagRankInfo();
                                pInfo.bIndex   = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Index"].Value);
                                pInfo.dwFaceID = Convert.ToUInt32(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["FaceID"].Value);
                                pInfo.dwUserID = Convert.ToUInt32(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["UserID"].Value);
                                pInfo.Gender   = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Gender"].Value) == 1 ? true : false;
                                pInfo.NickName = Convert.ToString(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Name"].Value);
                                pInfo.TitleID  = Convert.ToByte(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["TitleID"].Value);
                                pInfo.Param    = Convert.ToInt64(doc.ChildNodes[i].ChildNodes[k].ChildNodes[j].Attributes["Param"].Value);

                                pRankInfo.RankMap.Add(pInfo.bIndex, pInfo);
                            }
                        }
                        RankXmlMap.Add(pRankInfo.RankID, pRankInfo);
                    }
                }
                m_IsLoadXmlInfo = true;
                return(true);
            }
        }
        return(false);
    }
예제 #20
0
    private RankInfo BuildEntity()
    {
        RankInfo rank = new RankInfo();
        rank.ID = GetFormInteger("id");
        rank.Name = Request.Form["name"];

        return rank;
    }
예제 #21
0
 public async Task SaveToDb(RankInfo rankInfo)
 {
     using (this.context = new RankInfoDbContext())
     {
         context.RankInfoes.Add(rankInfo);
         await context.SaveChangesAsync();
     }
 }
예제 #22
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtEmployeeName.Text))
            {
                MessageBox.Show("등록 할 [직원 성명]을 입력해주세요.");
                return;
            }

            // creat
            var emp = new EmployeeVO()
            {
                empId        = "",// 이거는 입력해도 의미 없음
                birthDate    = employeeBirthDate.Value.ToUniversalTime().ToString("s") + "Z",
                birthState   = cboEmployeeBrithState.SelectedItem.ToString() == "양력" ? "0" : cboEmployeeBrithState.SelectedItem.ToString() == "음력" ? "1" : "",
                depart       = null,
                email        = txtEmailFirst.Text + "@" + cboEmailAddr.Text,
                empAddr      = txtEmployeeAddr.Text,
                empAddrDtl   = txtEmployeeAddrDtl.Text,
                empEngNm     = txtEmployeeEngName.Text,
                empFlag      = cboEmployeeType.SelectedItem.ToString() == "정규직" ? "0" : cboEmployeeType.SelectedItem.ToString() == "계약직" ? "1" : cboEmployeeType.SelectedItem.ToString() == "협력사직원" ? "2" : cboEmployeeType.SelectedItem.ToString() == "파트타임" ? "3" : "9",
                empHp        = txtEmployeeHtel.Text,
                empNm        = txtEmployeeName.Text,
                empPwd       = null,
                empTel       = txtEmployeeTel.Text,
                empZip       = txtEmployeeZip.Text,
                enteringDate = employeeEnteringDate.Value.ToUniversalTime().ToString("s") + "Z",
                leaveDate    = cboEmployeeLeaveType.Text != "퇴사" ? "" : employeeLeaveDate.Value.ToUniversalTime().ToString("s") + "Z",
                loginDate    = DateTime.MaxValue.ToUniversalTime().ToString("s") + "Z",
                maritalDate  = cboEmployeeMaritalState.SelectedItem.ToString() != "기혼" ? "" : employeeMarital_date.Value.ToUniversalTime().ToString("s") + "Z",
                maritalState = cboEmployeeMaritalState.SelectedItem.ToString() == "기혼" ? "1" : cboEmployeeMaritalState.SelectedItem.ToString() == "미혼" ? "0" : "",
                officeTel    = null,
                photo        = null,
                position     = null,
                reason       = null,
                regEmpId     = null,
                regEmpNm     = null,
                registDste   = DateTime.Now.ToUniversalTime().ToString("s") + "Z",

                rank = RankInfo.Where(o => o.rankName.Equals(cboRank.SelectedItem.ToString())).First(),

                project = ProjectInfo.Where(o => o.prjNm.Equals(cboProject.SelectedItem.ToString())).First(),

                spouseTel    = null,
                state        = null,
                team         = cboTeamName.Text,
                updateDate   = DateTime.Now.ToUniversalTime().ToString("s") + "Z",
                workPosition = cboWorkPosition.Text,
                userInfo     = "",
                rankDisp     = "",
                prjInfo      = null
            };

            ANBTX.Create("/api/employee", emp);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
예제 #23
0
        protected void RptItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            AuthorInfo author;

            if (Cache["M" + UserId] == null)
            {
                author = Members.GetAuthor(UserId);
                Cache.Insert("M" + UserId, author, null, DateTime.Now.AddMinutes(10d),
                             System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                author = (AuthorInfo)Cache["M" + UserId];
            }
            if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
            {
                if (author != null)
                {
                    Label litRank = (Label)item.FindControl("MemberTitleLabel");
                    if (litRank != null)
                    {
                        string   title = "";
                        RankInfo rInf  = new RankInfo(author.Username, ref title, author.PostCount, SnitzCachedLists.GetRankings());
                        if (Config.ShowRankTitle)
                        {
                            litRank.Text = title;
                        }
                    }
                    ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username);
                    if (prof.Gravatar)
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        avatar.Visible = false;
                        var ph = (PlaceHolder)item.FindControl("phAvatar");
                        ph.Visible = true;
                        var grav = new Gravatar {
                            Email = author.Email
                        };
                        if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                        {
                            grav.DefaultImage = author.AvatarUrl;
                        }
                        ph.Controls.Add(grav);
                    }
                    else
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        var ph     = (PlaceHolder)item.FindControl("phAvatar");
                        avatar.Text    = author.AvatarImg;
                        avatar.Visible = true;
                        ph.Visible     = false;
                    }
                }
            }
        }
예제 #24
0
    public void Set(RankInfo ri)
    {
        AutoHide = true;

        RankLab.text    = ri.Rank.ToString();
        PlayerName.text = ri.ServerRankInfo.name;
        Score.text      = ri.ServerRankInfo.score.ToString();

        SetBgType();
    }
예제 #25
0
        void EnsureFilesExist()
        {
            if (!Directory.Exists("properties"))
            {
                Directory.CreateDirectory("properties");
            }
            if (!Directory.Exists("levels"))
            {
                Directory.CreateDirectory("levels");
            }
            if (!Directory.Exists("bots"))
            {
                Directory.CreateDirectory("bots");
            }
            if (!Directory.Exists("text"))
            {
                Directory.CreateDirectory("text");
            }
            TempRanks.EnsureExists();
            RankInfo.EnsureExists();
            Ban.EnsureExists();

            if (!Directory.Exists("extra"))
            {
                Directory.CreateDirectory("extra");
            }
            if (!Directory.Exists("extra/undo"))
            {
                Directory.CreateDirectory("extra/undo");
            }
            if (!Directory.Exists("extra/undoPrevious"))
            {
                Directory.CreateDirectory("extra/undoPrevious");
            }
            if (!Directory.Exists("extra/copy/"))
            {
                Directory.CreateDirectory("extra/copy/");
            }
            if (!Directory.Exists("extra/copyBackup/"))
            {
                Directory.CreateDirectory("extra/copyBackup/");
            }
            if (!Directory.Exists("extra/Waypoints"))
            {
                Directory.CreateDirectory("extra/Waypoints");
            }
            if (!Directory.Exists("blockdefs"))
            {
                Directory.CreateDirectory("blockdefs");
            }
            if (!Directory.Exists("text/rankreqs"))
            {
                Directory.CreateDirectory("text/rankreqs");
            }
        }
예제 #26
0
    //private void Update()
    //{
    //    if (Input.GetKeyDown(KeyCode.C))
    //    {
    //        PlayerPrefs.SetString(RankDataKey, "");
    //        PlayerPrefs.Save();
    //    }
    //}

    public void AddNewRank(string PlayerName)
    {
        RankInfo NewRank = new RankInfo();

        NewRank.SetRankData(0, PlayerName, CurrentScore, CurrentDistance);
        List_RankInfo.Add(NewRank);
        ResetRankData();

        UIInRank.SetRankData(List_RankInfo);
        UIInRank.SetPlayerRankData(NewRank);
    }
예제 #27
0
 private void DisplayRank(RankInfo rankInfo)
 {
     if (rankInfo.rank < 0)
     {
         personalEntry.gameObject.SetActive(false); //This works because the scene will be reloaded if you get a high score
     }
     else
     {
         personalEntry.DisplayScore(rankInfo.rank + 1, rankInfo.username, rankInfo.score, true);
     }
 }
예제 #28
0
        public RankInfo GetRankInfo()
        {
            RankInfo RankInfo = new RankInfo()
            {
                MyRank    = UserManager.GetRankOfUser(InfrastructureSession.UserId.Value),
                PageIndex = 1,
            };

            RankInfo.Items = UserRepository.GetAll().Where(model => model.IsHide == false && model.IsSpreader == true).Take(100).OrderByDescending(model => model.Sales).MapTo <List <UserForRankDto> >();
            return(RankInfo);
        }
예제 #29
0
    private void CheckRankInfo()
    {
        RankInfo.LoadRank();

        if (RankInfo.CheckIfRankIn())
        {
            inputer.gameObject.SetActive(true);

            RankInfo.SortRank();
        }
    }
예제 #30
0
 public RankInfo SaveRank(RankInfo objRank)
 {
     if (objRank.RankId > 0)
     {
         UpdateRank(objRank);
     }
     else
     {
         objRank.RankId = AddRank(objRank);
     }
     return(GetRank(objRank.RankId));
 }
예제 #31
0
        public async Task <RankInfo> GetLastRankInfoAsync(long steamId = 0)
        {
            RankInfo        rankInfo        = null;
            List <RankInfo> rankAccountList = await GetRankInfoListAsync();

            if (rankAccountList.Any())
            {
                rankInfo = rankAccountList.FirstOrDefault(r => r.SteamId == steamId);
            }

            return(rankInfo);
        }
예제 #32
0
    public static RankInfo ParseToRankInfo(string RankData)
    {
        if(RankData == "")
        {
            return null;
        }

        RankInfo NewRankInfo = new RankInfo();
        string[] Rank = RankData.Split(',');
        NewRankInfo.SetRankData(int.Parse(Rank[0]), Rank[1], int.Parse(Rank[2]), int.Parse(Rank[3]));
        return NewRankInfo;
    }
예제 #33
0
    protected void BindGrid(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var member = (SnitzMembershipUser)e.Row.DataItem;
            var rankTitle = (Label)e.Row.FindControl("RankTitle");
            var rankStars = (Literal)e.Row.FindControl("RankStars");
            var lckUser = (ImageButton)e.Row.FindControl("lockUser");
            var unlckUser = (ImageButton)e.Row.FindControl("unlockUser");
            var delUser = (ImageButton)e.Row.FindControl("delUser");

            string title = "";
            RankInfo rInf = new RankInfo(member.UserName, ref title, member.Posts, SnitzCachedLists.GetRankings());
            rankTitle.Text = title;
            rankStars.Text = rInf.GetStars();

            if (lckUser != null)
            {
                lckUser.Visible = !member.IsLockedOut;
                lckUser.ToolTip = String.Format(webResources.lblLockUser, member.UserName);
                lckUser.OnClientClick =
                    "confirmPostBack('Do you want to lock the User?','LockMember','" + member.UserName +
                    "');return false;";
                if (unlckUser != null)
                {
                    unlckUser.Visible = member.IsLockedOut;
                    unlckUser.ToolTip = String.Format(webResources.lblUnlockUser, member.UserName);
                    unlckUser.OnClientClick =
                        "confirmPostBack('Do you want to unlock the User?','UnLockMember','" + member.UserName +
                        "');return false;";
                }

                if (delUser != null)
                {
                    delUser.Visible = true;
                    delUser.ToolTip = String.Format(webResources.lblDeleteUser, member.UserName);
                    delUser.OnClientClick =
                        "confirmPostBack('Do you want to delete the User?','DeleteMember','" + member.UserName +
                        "');return false;";
                }
            }
        }
    }
예제 #34
0
    private void SetProperties()
    {
        if (Config.ShowRankStars || Config.ShowRankTitle)
        {
            Literal litRank = (Literal)FindControl("Rank");
            if (litRank != null)
            {
                string title = "";
                RankInfo rInf = new RankInfo(_author.Username,ref title,_author.PostCount,SnitzCachedLists.GetRankings());
                if (Config.ShowRankTitle)
                    litRank.Text = title + @"<br/>";
                if (Config.ShowRankStars)
                {
                    litRank.Text += rInf.Stars;
                }
            }
        }

        ProfileCommon prof = ProfileCommon.GetUserProfile(_author.Username);
        if(prof.Gravatar)
        {
            Gravatar avatar = new Gravatar { Email = _author.Email };
            if (_author.AvatarUrl != "" && _author.AvatarUrl.StartsWith("http:"))
                avatar.DefaultImage = _author.AvatarUrl;
            avatar.CssClass = "avatar";
            phAvatar.Controls.Add(avatar);

        }else
        {
            SnitzMembershipUser mu = (SnitzMembershipUser)Membership.GetUser(_author.Username);
            Literal avatar = new Literal { Text = _author.AvatarImg };
            if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName)))
                avatar.Text = avatar.Text.Replace("'avatar'", "'avatar online'");
            phAvatar.Controls.Add(avatar);
        }
        country.Text = _author.Country.Trim();
        if (!String.IsNullOrEmpty(country.Text))
        {
            country.Text += "<br/>";
        }
        posts.Text = String.Format("{0} {1}", Common.TranslateNumerals(_author.PostCount), webResources.lblPosts);

        hProf.Visible = _loggedonuser;
        hProf.OnClientClick =
            String.Format(
                "mainScreen.LoadServerControlHtml('Public Profile',{{'pageID':1,'data':{0}}}, 'methodHandlers.BeginRecieve');return false;", _author.Id);

        if (!String.IsNullOrEmpty(_author.HomePage))
        {
            hHome.Visible = _loggedonuser && (_author.HomePage.Replace("http://", "").Trim() != string.Empty);
            hHome.NavigateUrl = string.Format("http://{0}", _author.HomePage.Replace("http://", ""));
            hHome.Text = hHome.ToolTip = webResources.lblHomePage;
        }
        if (!String.IsNullOrEmpty(_author.ICQ))
        {
            hICQ.Visible = _loggedonuser && (_author.ICQ.Trim() != "");
            hICQ.NavigateUrl = string.Format("http://www.icq.com/people/webmsg.php?to={0}", _author.ICQ.Trim());
            hICQ.Text = hICQ.ToolTip = webResources.lblICQ;
        }
        if (!String.IsNullOrEmpty(_author.Yahoo))
        {
            hYAHOO.Visible = _loggedonuser && (_author.Yahoo.Trim() != "");
            hYAHOO.NavigateUrl = string.Format("http://edit.yahoo.com/config/send_webmesg?.target={0}&;.src=pg",
                                               _author.Yahoo.Trim());
            hYAHOO.Text = hYAHOO.ToolTip = webResources.lblYAHOO;
        }

        hEmail.Visible = (((_loggedonuser || !Config.LogonForEmail) && _author.ReceiveEmails)) && Config.UseEmail;
        hEmail.NavigateUrl = "#";
        hEmail.Attributes.Add("onclick",
                                     string.Format(
                                         "mainScreen.LoadServerControlHtml('Email Member',{{'pageID':10,'data':{0}}},'methodHandlers.BeginRecieve');return false;",
                                         _author.Id));

        hAIM.Visible = _loggedonuser && (_author.AIM.Trim() != "");
        hAIM.NavigateUrl = string.Format("aim:goim?screenname={0}", _author.AIM.Trim());
        hAIM.Text = hAIM.ToolTip = webResources.lblAIM;

        hSKYPE.Visible = _loggedonuser && !String.IsNullOrEmpty(_author.Skype.Trim());
        hSKYPE.NavigateUrl = String.Format("skype:{0}?chat",_author.Skype.Trim());
        hSKYPE.Text = hSKYPE.ToolTip = webResources.lblSkype;

        hSendPm.Visible = (_loggedonuser || !Config.PrivateMessaging) && prof.PMReceive == 1;
        hSendPm.NavigateUrl = "#";
        hSendPm.Attributes.Add("onclick",
                                     string.Format(
                                         "mainScreen.LoadServerControlHtml('Send Private Message',{{'pageID':13,'data':{0}}},'methodHandlers.BeginRecieve');return false;",
                                         _author.Id));
    }
예제 #35
0
 public void SetPlayerRankData(RankInfo PlayerRankInfo)
 {
     ChildPlayerRank.PlayerRanking.text = PlayerRankInfo.Ranking.ToString();
     ChildPlayerRank.PlayerScore.text = PlayerRankInfo.Score + Config.CPoint;
     ChildPlayerRank.PlayerDistance.text = PlayerRankInfo.Distance + Config.CMeter;
 }
예제 #36
0
    protected void MgvRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var member = (MemberInfo)e.Row.DataItem;
            var rankTitle = (Label) e.Row.FindControl("RankTitle");
            var rankStars = (Literal) e.Row.FindControl("RankStars");
            var lckUser = (ImageButton)e.Row.FindControl("lockUser");
            var unlckUser = (ImageButton)e.Row.FindControl("unlockUser");
            var delUser = (ImageButton)e.Row.FindControl("delUser");
            RankInfo rInf;
            try
            {
                string title = "";
                rInf = new RankInfo(member.Username, ref title, member.PostCount, SnitzCachedLists.GetRankings());
                rankTitle.Text = title;
                rankStars.Text = rInf.GetStars();
            }
            catch (Exception)
            {

                throw;
            }

            if ((!IsAdministrator))
            {
                e.Row.Cells.RemoveAt(8);
                e.Row.Cells.RemoveAt(7);
            }
            if (lckUser != null)
            {
                lckUser.Visible = (IsAdministrator) && member.Status == 1;
                lckUser.ToolTip = String.Format(webResources.lblLockUser, member.Username);
                lckUser.OnClientClick =
                    "confirmPostBack('Do you want to lock the User?','LockMember','" + member.Username + "');return false;";
            }
            if (unlckUser != null)
            {
                unlckUser.Visible = (IsAdministrator) && member.Status == 0;
                unlckUser.ToolTip = String.Format(webResources.lblUnlockUser, member.Username);
                unlckUser.OnClientClick =
                    "confirmPostBack('Do you want to unlock the User?','UnLockMember','" + member.Username + "');return false;";
            }

            if (delUser != null)
            {
                delUser.Visible = (IsAdministrator);
                delUser.ToolTip = String.Format(webResources.lblDeleteUser, member.Username);
                delUser.OnClientClick =
                    "confirmPostBack('Do you want to delete the User?','DeleteMember','" + member.Username + "');return false;";
            }
        }
        if(e.Row.RowType == DataControlRowType.Header)
        {
            if ((!IsAdministrator))
            {
                e.Row.Cells.RemoveAt(8);
                e.Row.Cells.RemoveAt(7);
            }
        }
    }
예제 #37
0
 public RankInfo SaveRank(RankInfo objRank) {
     if (objRank.RankId > 0) {
         UpdateRank(objRank);
     } else {
         objRank.RankId = AddRank(objRank);
     }
     return GetRank(objRank.RankId);
 }
예제 #38
0
        private void SendOverRankInfo()
        {
            stPkgHead head = new stPkgHead();
            head.iSytle = 80;
            RankInfo[] info = new RankInfo[ships.Length];
            byte[] buffer = new byte[ships.Length * RankInfo.TotolLength];

            for (int i = 0; i < ships.Length; i++)
            {
                info[i].Score = ships[i].Score;
                info[i].Rank = 0;
                info[i].Name = new char[RankInfo.NameLength];

                for (int j = 0; j < ships[i].PlayerName.Length; j++)
                {
                    info[i].Name[j] = ships[i].PlayerName[j];
                }

                byte[] temp = SocketMgr.StructToBytes(info[i]);
                temp.CopyTo(buffer, i * RankInfo.TotolLength);
            }

            MemoryStream stream = new MemoryStream();
            stream.Write(buffer, 0, buffer.Length);
            head.dataSize = buffer.Length;

            SocketMgr.SendCommonPackge(head, stream);
            stream.Close();
        }
예제 #39
0
		public int AddRank(RankInfo objRank)
		{
			return dataProvider.AddRank(objRank.PortalId, objRank.ModuleId, objRank.RankName, objRank.MinPosts, objRank.MaxPosts, objRank.Display, objRank.CreatedOnDate);
		}
예제 #40
0
		public void UpdateRank(RankInfo objRank)
		{
			dataProvider.UpdateRank(objRank.RankId, objRank.PortalId, objRank.ModuleId, objRank.RankName, objRank.MinPosts, objRank.MaxPosts, objRank.Display, objRank.LastModifiedOnDate);
			//Caching.ClearRankingCache(objRank.portalId);
		}
예제 #41
0
    //private void Update()
    //{
    //    if (Input.GetKeyDown(KeyCode.C))
    //    {
    //        PlayerPrefs.SetString(RankDataKey, "");
    //        PlayerPrefs.Save();
    //    }
    //}
    public void AddNewRank(string PlayerName)
    {
        RankInfo NewRank = new RankInfo();
        NewRank.SetRankData(0, PlayerName, CurrentScore, CurrentDistance);
        List_RankInfo.Add(NewRank);
        ResetRankData();

        UIInRank.SetRankData(List_RankInfo);
        UIInRank.SetPlayerRankData(NewRank);
    }