00001 /* 00002 * The Mana World 00003 * Copyright (C) 2004 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef CHAR_SELECT_H 00023 #define CHAR_SELECT_H 00024 00025 #include "gui/widgets/window.h" 00026 00027 #include "being.h" 00028 #include "guichanfwd.h" 00029 #include "lockedarray.h" 00030 00031 #include <guichan/actionlistener.hpp> 00032 00033 #ifdef TMWSERV_SUPPORT 00034 #include "../logindata.h" 00035 #endif 00036 00037 class LocalPlayer; 00038 class Player; 00039 class PlayerBox; 00040 00046 class CharSelectDialog : public Window, public gcn::ActionListener 00047 { 00048 public: 00049 friend class CharDeleteConfirm; 00053 #ifdef TMWSERV_SUPPORT 00054 CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, 00055 LoginData *loginData); 00056 #else 00057 CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, 00058 Gender gender); 00059 #endif 00060 00061 void action(const gcn::ActionEvent &event); 00062 00063 void updatePlayerInfo(); 00064 00065 void logic(); 00066 00067 bool selectByName(const std::string &name); 00068 00069 private: 00070 LockedArray<LocalPlayer*> *mCharInfo; 00071 00072 gcn::Button *mSelectButton; 00073 gcn::Button *mCancelButton; 00074 gcn::Button *mPreviousButton; 00075 gcn::Button *mNextButton; 00076 00077 gcn::Label *mNameLabel; 00078 gcn::Label *mLevelLabel; 00079 gcn::Label *mMoneyLabel; 00080 std::string mMoney; 00081 00082 PlayerBox *mPlayerBox; 00083 00084 bool mCharSelected; 00085 00086 #ifdef TMWSERV_SUPPORT 00087 gcn::Button *mNewCharButton; 00088 gcn::Button *mDelCharButton; 00089 gcn::Button *mUnRegisterButton; 00090 gcn::Button *mChangePasswordButton; 00091 gcn::Button *mChangeEmailButton; 00092 gcn::Label *mAccountNameLabel; 00093 00094 LoginData *mLoginData; 00095 #else 00096 gcn::Button *mNewDelCharButton; 00097 gcn::Label *mJobLevelLabel; 00098 Gender mGender; 00099 #endif 00100 00104 void attemptCharDelete(); 00105 00109 void attemptCharSelect(); 00110 }; 00111 00112 #endif