public SendCustomizationSettingsMessage(byte[] data) : base(data)
        {
            try
            {
                var lines = BytesToString(data, 1).Split(',');
                Selections = new UserSelections
                {
                    Character      = Convert.ToInt32(lines[0]),
                    House          = Convert.ToInt32(lines[1]),
                    Background     = Convert.ToInt32(lines[2]),
                    Pet            = Convert.ToInt32(lines[3]),
                    LobbyIcon      = Convert.ToInt32(lines[4]),
                    DeathAnimation = Convert.ToInt32(lines[5]),
                    InGameName     = lines[9]
                };

                for (var i = 6; i < 9; i++)
                {
                    Selections.Scrolls[i] = Convert.ToInt32(lines[i]);
                }
            }
            catch (Exception ex)
            {
                ThrowNetworkMessageFormatException(ex);
            }
        }
Exemple #2
0
        private void plotLineChart()
        {
            if (axis == 1)
            {
                plotMarks();
            }

            int normalIndex = UserSelections.getIndex(currentScene, UserSelections.NormalMode);

            if (normalIndex != -1 && user.Index[normalIndex] != -1)
            {
                plotExperienceLine(UserSelections.NormalMode, normalIndex);
            }

            int distractAIndex = UserSelections.getIndex(currentScene, UserSelections.DistractAMode);

            if (distractAIndex != -1 && user.Index[distractAIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractAMode, distractAIndex);
            }

            int distractBIndex = UserSelections.getIndex(currentScene, UserSelections.DistractBMode);

            if (distractBIndex != -1 && user.Index[distractBIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractBMode, distractBIndex);
            }

            int distractCIndex = UserSelections.getIndex(currentScene, UserSelections.DistractCMode);

            if (distractCIndex != -1 && user.Index[distractCIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractCMode, distractCIndex);
            }

            int distractDIndex = UserSelections.getIndex(currentScene, UserSelections.DistractDMode);

            if (distractDIndex != -1 && user.Index[distractDIndex] != -1)
            {
                plotExperienceLine(UserSelections.DistractDMode, distractDIndex);
            }
        }
Exemple #3
0
        private void ConfirmDeleteDataBtn_Click(object sender, RoutedEventArgs e)
        {
            Scene selectedScene = SceneComboBox.SelectedItem as Scene;
            Mode  selectedMode  = ModeComboBox.SelectedItem as Mode;

            if (selectedScene.SceneValue == -1 || selectedMode.ModeValue == -1)
            {
                DeleteTip.Text = "请选择正确的场景和模式";
                return;
            }

            bool?confirmResult = CustomMessageBox.Show
                                     ("Confirmation", "确定删除该条数据吗? " + selectedScene.SceneName + " " + selectedMode.ModeName);

            if (confirmResult == true)
            {
                bool deleteResult =
                    deleteData(UserSelections.getIndex(selectedScene.SceneValue, selectedMode.ModeValue));
                DeleteTip.Text = deleteResult ? "记录已成功删除" : "没有该条记录";
                refreshData();
            }
        }
Exemple #4
0
        // distance oriented
        private void plotMarks()
        {
            if (currentScene == UserSelections.ScenePractice)
            {
                return;
            }

            SimulatedVehicle top    = new SimulatedVehicle();
            SimulatedVehicle bottom = new SimulatedVehicle();

            int            count = 0;
            int            index;
            ExperienceUnit unit = null;

            foreach (int mode in UserSelections.ModeList)
            {
                index = user.Index[UserSelections.getIndex(currentScene, mode)];
                if (index != -1)
                {
                    unit = user.Experiences[index];
                    foreach (PropertyInfo p in top.GetType().GetProperties())
                    {
                        if ((float)p.GetValue(unit.Top) > (float)p.GetValue(top))
                        {
                            p.SetValue(top, (float)p.GetValue(unit.Top));
                        }

                        if ((float)p.GetValue(unit.Bottom) < (float)p.GetValue(bottom))
                        {
                            p.SetValue(bottom, (float)p.GetValue(unit.Bottom));
                        }
                    }
                    ++count;
                }
            }


            if (count != 0)
            {
                foreach (DistractMark mark in unit.Marks)
                {
                    float start = mark.Start.TotalDistance;
                    float end   = mark.End.TotalDistance;

                    SpeedChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.Speed),
                        new Point(start, bottom.Speed), new Point(end, bottom.Speed), new Point(end, top.Speed), new Point(start, top.Speed)
                    });
                    OffsetChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.Offset),
                        new Point(start, bottom.Offset), new Point(end, bottom.Offset), new Point(end, top.Offset), new Point(start, top.Offset)
                    });
                    AccelerationChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.Acceleration),
                        new Point(start, bottom.Acceleration), new Point(end, bottom.Acceleration), new Point(end, top.Acceleration), new Point(start, top.Acceleration)
                    });
                    BrakeChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.BrakePedal),
                        new Point(start, bottom.BrakePedal), new Point(end, bottom.BrakePedal), new Point(end, top.BrakePedal), new Point(start, top.BrakePedal)
                    });
                    FollowChart.AddAMarker(new List <Point>()
                    {
                        new Point(start, top.DistanceToNext),
                        new Point(start, bottom.DistanceToNext), new Point(end, bottom.DistanceToNext), new Point(end, top.DistanceToNext), new Point(start, top.DistanceToNext)
                    });
                }
            }

            if (showMark && axis == 1)
            {
                showMarkers();
            }
            else
            {
                hideMarkers();
            }
        }
Exemple #5
0
        private string getCheck(int scene, int mode)
        {
            int index = UserSelections.getIndex(scene, mode);

            return(PageList.Main.User.Index[index] == -1 ? "" : "√");
        }
Exemple #6
0
        /*
         * returns the MapPage depending upon the user selection
         */
        public ActionResult MapPage(string[] cMonths, string[] cInterests, string[] cDistance)
        {
            UserSelections us = new UserSelections();

            us.cMonths        = cMonths;
            us.cInterests     = cInterests;
            us.cDistance      = cDistance;
            us.combinedString = "";
            if (cMonths != null)
            {
                for (int i = 0; i < cMonths.Length; i++)
                {
                    if (i == cMonths.Length - 1)
                    {
                        us.combinedString = us.combinedString + cMonths[i].ToLower() + "|";
                    }
                    else
                    {
                        us.combinedString = us.combinedString + cMonths[i].ToLower() + ",";
                    }
                }
            }
            else
            {
                DateTime      now      = DateTime.Now;
                string        currentM = now.ToString("MMMM");
                List <string> months   = new List <string>();
                months.Add(currentM);
                us.cMonths        = months.ToArray();
                us.combinedString = currentM + "|";
            }
            if (cInterests != null)
            {
                for (int i = 0; i < cInterests.Length; i++)
                {
                    if (i == cInterests.Length - 1)
                    {
                        us.combinedString = us.combinedString + cInterests[i] + "|";
                    }
                    else
                    {
                        us.combinedString = us.combinedString + cInterests[i] + ",";
                    }
                }
            }
            else
            {
                List <string> ints = new List <string>();
                ints.Add("Museums");
                ints.Add("Sights and Landmarks");
                ints.Add("Nature and Parks");
                ints.Add("Beaches");
                ints.Add("Outdoor Activities and Tours");
                ints.Add("Nature and Wildlife Areas");
                ints.Add("Hiking Trails");
                ints.Add("Fun and Games and Sports");
                ints.Add("Zoos and Aquariums");
                us.cInterests     = ints.ToArray();
                us.combinedString = us.combinedString + "null|";
            }
            if (cDistance != null && !cDistance.Equals(""))
            {
                us.combinedString = us.combinedString + cDistance[0];
            }
            else
            {
                List <string> dis = new List <string>();
                dis.Add("100");
                us.cDistance      = dis.ToArray();
                us.combinedString = us.combinedString + 100;
            }
            return(View(us));
        }