Example #1
0
        // 프로필을 UI에 뿌리기
        private void loadProfile(int index)
        {
            isLoading = true;

            RiderProfile profile = (RiderProfile)riderProfiles[index];

            textNick.Text = profile.NickName;

            int kartIndex = Enum.getKartTypeIndex(profile.KartType);

            comboKartType.SelectedIndex = kartIndex;

            int charIndex = Enum.getCharTypeIndex(profile.CharType);

            comboChar.SelectedIndex = charIndex;

            int charColorIndex = Enum.getColorTypeIndex(profile.CharColor.ToString());

            comboCharColor.SelectedIndex = charColorIndex;

            checkMission1.Checked = (profile.ModeClear & 1) != 0;
            checkMission2.Checked = (profile.ModeClear & 2) != 0;

            isLoading = false;
        }
Example #2
0
        private void buttonAddProfile_Click(object sender, EventArgs e)
        {
            RiderProfile profile = new RiderProfile(true); // 랜덤 프로필 생성

            riderProfiles.Add(profile);
            comboProfle.Items.Add(profile.NickName);

            comboProfle.SelectedIndex = comboProfle.Items.Count - 1;

            MessageBox.Show("프로필을 추가했습니다.");
        }
Example #3
0
 public RiderProfile(RiderProfile copy)
 {
     NickName      = copy.NickName;
     CharType      = copy.CharType;
     KartType      = copy.KartType;
     CharColor     = copy.CharColor;
     UnknownValue1 = copy.UnknownValue1;
     ModeClear     = copy.ModeClear;
     UnknownValue2 = copy.UnknownValue2;
     UnknownValue3 = copy.UnknownValue3;
 }
Example #4
0
        // 프로필 저장하기
        private void saveProfileToFile()
        {
            // 프로필 개수
            int profileCount = riderProfiles.Count;

            if (profileCount == 0)
            {
                MessageBox.Show("저장하려는 내용이 없습니다.");
                return;
            }

            string filePath = getSaveFilePath();

            if (filePath == null)
            {
                MessageBox.Show("프로필 파일이 저장될 위치가 없습니다.\n카트라이더 데모를 실행하여 캐릭터를 만든 이후에 진행하시고\n같은 문제 계속시 문의 바랍니다.");
                return;
            }

            FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);

            writeIntToFs(fs, profileCount);

            for (int i = 0; i < profileCount; i++)
            {
                RiderProfile profile = (RiderProfile)riderProfiles[i];

                writeStringToFs(fs, profile.NickName);
                writeStringToFs(fs, profile.CharType);
                writeStringToFs(fs, profile.KartType);
                writeIntToFs(fs, profile.CharColor);
                writeIntToFs(fs, profile.UnknownValue1, 2);
                writeIntToFs(fs, profile.ModeClear);
                writeIntToFs(fs, profile.UnknownValue2);
                writeIntToFs(fs, profile.UnknownValue3, 2);
            }

            fs.Close();

            MessageBox.Show("저장되었습니다.");
        }
Example #5
0
        private void saveProfile(int index = -1)
        {
            if (index == -1)
            {
                index = comboProfle.SelectedIndex;
            }

            if (isLoading)
            {
                return;
            }

            string nickName = textNick.Text;

            int kartIndex      = comboKartType.SelectedIndex;
            int charIndex      = comboChar.SelectedIndex;
            int charColorIndex = comboCharColor.SelectedIndex;

            string kartCode      = Enum.KART_TYPE[kartIndex, 0];
            string charCode      = Enum.CHAR_TYPE[charIndex, 0];
            int    charColorCode = Int32.Parse(Enum.COLOR_TYPE[charColorIndex, 0]);

            int modeClear = 0;

            modeClear += checkMission1.Checked ? 1 : 0;
            modeClear += checkMission2.Checked ? 2 : 0;

            RiderProfile profile = (RiderProfile)riderProfiles[index];

            profile.NickName  = nickName;
            profile.KartType  = kartCode;
            profile.CharType  = charCode;
            profile.CharColor = charColorCode;
            profile.ModeClear = modeClear;

            comboProfle.Items[index] = nickName;
        }
Example #6
0
        // 프로필 불러오기
        private void loadProfileFromFile()
        {
            isLoading = true;

            string filePath = getSaveFilePath();

            if (filePath == null)
            {
                MessageBox.Show("저장된 프로필 파일을 찾을 수 없습니다.\n카트라이더 데모를 실행하여 캐릭터를 만든 이후에 진행하시고\n같은 문제 계속시 문의 바랍니다.");
                return;
            }

            FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);

            fs.Seek(0, SeekOrigin.Begin);

            int profileCount = readIntFromFs(fs);

            comboProfle.Items.Clear();
            riderProfiles.Clear();

            for (int i = 0; i < profileCount; i++)
            {
                RiderProfile profile = new RiderProfile();

                string nickName  = readStringFromFs(fs);
                string charType  = readStringFromFs(fs);
                string kartType  = readStringFromFs(fs);
                int    charColor = readIntFromFs(fs);
                short  unkValue1 = (short)readIntFromFs(fs, 2);
                int    modeClear = readIntFromFs(fs);
                int    unkValue2 = readIntFromFs(fs);
                short  unkValue3 = (short)readIntFromFs(fs, 2);

                profile.NickName      = nickName;
                profile.CharType      = charType;
                profile.KartType      = kartType;
                profile.CharColor     = charColor;
                profile.UnknownValue1 = unkValue1;
                profile.ModeClear     = modeClear;
                profile.UnknownValue2 = unkValue2;
                profile.UnknownValue3 = unkValue3;

                riderProfiles.Add(profile);
                comboProfle.Items.Add(nickName);
            }

            fs.Close();

            MessageBox.Show("프로필을 불러왔습니다.");

            if (comboProfle.Items.Count > 0)
            {
                comboProfle.SelectedIndex = 0;
                loadProfile(0);
                panelProfileMain.Enabled = true;
            }
            else
            {
                panelProfileMain.Enabled = false;
            }

            isLoading = false;
        }