コード例 #1
0
ファイル: MainForm.cs プロジェクト: apple1417/CarWarpHelper
        private void Update(object myObject, EventArgs myEventArgs)
        {
            if (!EnsureHooked())
            {
                return;
            }

            allPosInputs.ForEach(input => input.ValueChanged -= Position_ValueChanged);

            try {
                Vect3F pos = GameHook.Position;

                if (xLock.Checked)
                {
                    pos.X = Convert.ToSingle(xInput.Value);
                }
                else
                {
                    xInput.Value = Convert.ToDecimal(GameHook.Position.X);
                }

                if (yLock.Checked)
                {
                    pos.Y = Convert.ToSingle(yInput.Value);
                }
                else
                {
                    yInput.Value = Convert.ToDecimal(GameHook.Position.Y);
                }

                if (zLock.Checked)
                {
                    pos.Z = Convert.ToSingle(zInput.Value);
                }
                else
                {
                    zInput.Value = Convert.ToDecimal(GameHook.Position.Z);
                }

                if (xLock.Checked || yLock.Checked || zLock.Checked)
                {
                    GameHook.Position = pos;
                }

                allPosInputs.ForEach(input => input.Enabled = true);

                // Should be caused by invalid pointers - most likely you're on the main menu
            } catch (Win32Exception) {
                allPosInputs.ForEach(input => input.Enabled = false);
            }

            allPosInputs.ForEach(input => input.ValueChanged += Position_ValueChanged);
        }
コード例 #2
0
        public StationManager()
        {
            coordMap   = new Dictionary <string, Dictionary <string, Vect3F> >();
            stationMap = new Dictionary <string, List <string> >();
            worlds     = new List <string>();

            currentWorldIdx   = 0;
            currentStationIdx = 0;

            string currentWorld = UNKNOWN_WORLD_NAME;

            coordMap[UNKNOWN_WORLD_NAME]   = new Dictionary <string, Vect3F>();
            stationMap[UNKNOWN_WORLD_NAME] = new List <string>();
            worlds.Add(UNKNOWN_WORLD_NAME);

            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(Properties.Resources.coords ?? "")))
                using (TextFieldParser parser = new TextFieldParser(stream)) {
                    parser.SetDelimiters(",");
                    parser.ReadLine(); // Skip the header row

                    while (!parser.EndOfData)
                    {
                        string[] row = parser.ReadFields();
                        if (row[1] == "")
                        {
                            currentWorld             = row[0];
                            coordMap[currentWorld]   = new Dictionary <string, Vect3F>();
                            stationMap[currentWorld] = new List <string>();
                            worlds.Add(currentWorld);
                            continue;
                        }

                        coordMap[currentWorld][row[0]] = new Vect3F()
                        {
                            X = float.Parse(row[1]),
                            Y = float.Parse(row[2]),
                            Z = float.Parse(row[3])
                        };
                        stationMap[currentWorld].Add(row[0]);
                    }
                }

            if (coordMap[UNKNOWN_WORLD_NAME].Count == 0)
            {
                coordMap.Remove(UNKNOWN_WORLD_NAME);
                stationMap.Remove(UNKNOWN_WORLD_NAME);
                worlds.Remove(UNKNOWN_WORLD_NAME);
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: apple1417/CarWarpHelper
        private void Position_ValueChanged(object sender, EventArgs e)
        {
            if (!EnsureHooked())
            {
                return;
            }

            try {
                Vect3F pos = GameHook.Position;
                pos.X             = Convert.ToSingle(xInput.Value);
                pos.Y             = Convert.ToSingle(yInput.Value);
                pos.Z             = Convert.ToSingle(zInput.Value);
                GameHook.Position = pos;
            } catch (Win32Exception) { }
        }