コード例 #1
0
        public void UpdateCurrentMap(JObject j)
        {
            WorldMap map = j["value"]["maps"][0].ToObject <WorldMap>();

            worldMaps[currentMapId] = map;

            StepList.BeginUpdate();

            StepList.Clear();

            try
            {
                List <Step> steps = map.steps.ToList();
                steps.Sort((Step a, Step b) => a.position.CompareTo(b.position));

                foreach (Step step in steps)
                {
                    StepList.Items.Add($"{step.position} {(map.curr_position == step.position ? step.capture - map.curr_capture : (map.curr_position > step.position ? 0 : step.capture)).ToString("f1")}/{step.capture.ToString("f1")}");
                }

                StepList.EnsureVisible(map.curr_position);
                StepList.Items[map.curr_position].Selected = true;
                StepList.Select();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString());
                StepList.Clear();
            }

            StepList.EndUpdate();

            TotalStep.Text = map.steps.Sum((s) => s.capture).ToString();
        }