Advertisement
jolievivienne

urho friendships

Jun 8th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.74 KB | None | 0 0
  1. class ExistenceClient : public ExistenceApp
  2. {
  3.     OBJECT(ExistenceClient);
  4.  
  5.     /// friendship
  6.    friend class GameStateHandlerComponent;
  7.    friend class ExistenceClientStateSingleton;
  8.    friend class ExistenceClientStateMainScreen;
  9.  
  10. public:
  11.  
  12.  
  13.     /// Construct.
  14.     ExistenceClient(Context* context);
  15.     virtual ~ExistenceClient();
  16.  
  17.     /// Setup after engine initialization and before running the main loop.
  18.     virtual void Start();
  19.  
  20.     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.https://github.com/urho3d/Urho3D/tree/master/Source/Samples
  21.     virtual String GetScreenJoystickPatchString() const
  22.     {
  23.         return
  24.             "<patch>"
  25.             "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
  26.             "        <attribute name=\"Is Visible\" value=\"false\" />"
  27.             "    </add>"
  28.             "</patch>";
  29.     }
  30.  
  31.     void Init(Context * context);
  32.  
  33.     /// Diaplay login screen
  34.     void SetupScreenViewport(void);
  35.     void SetupScreenUI(void);
  36.  
  37.     /// Subscribe to application-wide logic update events.
  38.     void SubscribeToEvents();
  39.     /// Handle the logic update event.
  40.     void HandleUpdate(StringHash eventType, VariantMap& eventData);
  41.     /// Events Keyboard
  42.     void HandleKeyDown(StringHash eventType, VariantMap& eventData);
  43.  
  44.     void HandleInput(const String& input);
  45.     void eraseScene(void);
  46.  
  47.     void AddLogoViewport(void);
  48.  
  49.     int CreateCursor(void);
  50.  
  51.     void MoveCamera(float timeStep);
  52.     void Print(const String& output);
  53.  
  54.     void HandlePostUpdates(StringHash eventType, VariantMap& eventData);
  55.  
  56.     /// Render related functions
  57.     int LoadCharacterMesh(int mode, String nodename, unsigned int alienrace, unsigned int gender);
  58.     int loadplayerMesh(Node * playermeshNode, int alienrace, int gender,int mode);
  59.  
  60.     /// File related functions
  61.     void LoadAccount(void);
  62.     void SaveAccount(accountinformation account);
  63.     void SavePlayer(bool activeplayer);
  64.     int LoadAccountPlayers(void);
  65.     int LoadPlayer(int player);
  66.     int LoadTemporaryPlayer(int player);
  67.     int GenerateSceneLoadDifferential(const char *filename=NULL);
  68.     int LoadEnvironmentSettings(const char *environment);
  69.  
  70.     /// Console related functions
  71.     void InitializeConsole(void);
  72.     void HandleConsoleCommand(StringHash eventType, VariantMap& eventData);
  73.  
  74.     int ConsoleActionEnvironment(const char * lineinput);
  75.     int ConsoleActionCamera(const char * lineinput);
  76.     int ConsoleActionDebug(const char * lineinput);
  77.     int ConsoleActionCharacter(const char * lineinput);
  78.     int ConsoleActionRenderer(const char * lineinput);
  79.     int ConsoleActionBuild(const char * lineinput);
  80.  
  81.     /// UI Related Functions
  82.     void loadSceneUI(void);
  83.     bool loadHUDFile(const char * filename, const int positionx, const int positiony);
  84.     void loadUIXMLClosePressed(StringHash eventType, VariantMap& eventData);
  85.     bool loadUIXML(int windowtype, const int positionx, const int positiony, int selected);
  86.     void QuickMenuPressed(StringHash eventType, VariantMap& eventData);
  87.     void UpdateUI(float timestep);
  88.     void PlayerWindowUpdateUI(int selected);
  89.     void PlayerWindowHandleDisplaySelection(StringHash eventType, VariantMap& eventData);
  90.     int UpdateUISceneLoader(void);
  91.     void UpdatePlayerInfoBar(void);
  92.     void SceneLoaderHanderPress(StringHash eventType, VariantMap& eventData);
  93.     int GenerateSceneUpdateEnvironment(terrain_rule terrainrule);
  94.  
  95.     /// Temporary online
  96.     bool IsClientConnected(void);
  97.     bool ClientConnect(void);
  98.     bool SetServerSettings(void);
  99.  
  100.     /// Get subsubsystems
  101.     Renderer * GetRenderSubsystems(void) const;
  102.     UI * GetUISubsystems(void) const;
  103.     Graphics * GetGraphicsSubsystems(void) const;
  104.     ResourceCache * GetResourceCacheSubsystems(void) const;
  105.  
  106.     Window * GetSharedWindow(void) const;
  107.  
  108.     int GetTestString(void)
  109.     {
  110.         return testvalue;
  111.     }
  112.  
  113. protected:
  114.     /// Urho3D window shared pointers
  115.     SharedPtr<Window> window_;
  116.     SharedPtr<Window> window2_;
  117.  
  118.     /// Urho3D UIelement root, viewport, and render path
  119.     SharedPtr<UIElement> uiRoot_;
  120.     SharedPtr<Viewport> viewport;
  121.  
  122.     SharedPtr<RenderPath> effectRenderPath;
  123.  
  124.     /// Urho3D Shared pointer for input
  125.     SharedPtr<Input> input_;
  126.  
  127.     /// Existence Weak pointer for a single character
  128.     WeakPtr<Character> character_;
  129.  
  130.  
  131.     /// Existence player structure class and variable declation for character/player related information
  132.     Player  TemporaryPlayer;
  133.     Player  * TemporaryAccountPlayerList;
  134.     unsigned int TemporaryAccountPlayerSelected;
  135.     unsigned int TemporaryAccountPlayerListLimit;
  136.  
  137.     /// Existence class and variable declaration for alien race alliance information
  138.     vector<string> aliensarray;
  139.     vector<string> tempaliensarray;
  140.  
  141.     /// This is temoporarily the necessary code
  142.     bool accountexist;
  143.  
  144.     /// Server connection related
  145.     bool ServerConnection;
  146.  
  147.     int testvalue;
  148.  
  149. private:
  150.  
  151. };
  152.  
  153. /// Login State
  154. class ExistenceClientStateSingleton : public LogicComponent
  155. {
  156.     OBJECT(ExistenceClientStateSingleton);
  157. public:
  158.     ExistenceClientStateSingleton(Context * context);
  159.     virtual ~ExistenceClientStateSingleton();
  160.     virtual void Enter();
  161.     virtual void Exit();
  162.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  163. private:
  164.     void Singleton(void);
  165. protected:
  166.  
  167. };
  168.  
  169. /// Login State
  170. class ExistenceClientStateLogin : public ExistenceClientStateSingleton
  171. {
  172.     OBJECT(ExistenceClientStateLogin);
  173. public:
  174.     ExistenceClientStateLogin(Context * context);
  175.     virtual ~ExistenceClientStateLogin();
  176.     virtual void Enter();
  177.     virtual void Exit();
  178.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  179. private:
  180.     void LoginScreen(void);
  181.     void LoginScreenUI(void);
  182.     void LoginScreenUINewAccountHandleClosePressed(StringHash eventType, VariantMap& eventData);
  183.     void LoginScreenUILoginHandleClosePressed(StringHash eventType, VariantMap& eventData);
  184.  
  185. protected:
  186.  
  187. };
  188.  
  189. /// Account State
  190. class ExistenceClientStateAccount: public ExistenceClientStateSingleton
  191. {
  192.     OBJECT(ExistenceClientStateAccount);
  193. public:
  194.     ExistenceClientStateAccount(Context * context);
  195.     virtual ~ ExistenceClientStateAccount();
  196.     virtual void Enter();
  197.     virtual void Exit();
  198.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  199. private:
  200.     void Account(void);
  201.     void CreateAccountScreenUI(void);
  202.     void CreateAccountUIHandleClosePressed(StringHash eventType, VariantMap& eventData);
  203. protected:
  204.  
  205. };
  206.  
  207. /// Main Screen State
  208. class ExistenceClientStateMainScreen: public ExistenceClientStateSingleton
  209. {
  210.     OBJECT(ExistenceClientStateMainScreen);
  211. public:
  212.     ExistenceClientStateMainScreen(Context * context);
  213.     virtual ~ExistenceClientStateMainScreen();
  214.     virtual void Enter();
  215.     virtual void Exit();
  216.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  217. private:
  218.     void MainScreen(void);
  219.     void MainScreenUI(void);
  220.     void MainScreenUIHandleClosePressed(StringHash eventType, VariantMap& eventData);
  221.     void HandleCharacterStartButtonReleased(StringHash eventType, VariantMap& eventData);
  222.     void HandleCharacterSelectedReleased(StringHash eventType, VariantMap& eventData);
  223.     void HandleCharacterSelectedInfoButtonReleased(StringHash eventType, VariantMap& eventData);
  224. protected:
  225.  
  226. };
  227.  
  228. /// Main Screen State
  229. class ExistenceClientStateGameMode: public ExistenceClientStateSingleton
  230. {
  231.     OBJECT(ExistenceClientStateGameMode);
  232. public:
  233.     ExistenceClientStateGameMode(Context * context);
  234.     virtual ~ExistenceClientStateGameMode();
  235.     virtual void Enter();
  236.     virtual void Exit();
  237.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  238. private:
  239.     void GameMode(void);
  240. protected:
  241.  
  242. };
  243.  
  244. /// Player Create Login State
  245. class ExistenceClientStatePlayer: public ExistenceClientStateSingleton
  246. {
  247.     OBJECT(ExistenceClientStatePlayer);
  248. public:
  249.     ExistenceClientStatePlayer(Context * context);
  250.     virtual ~ExistenceClientStatePlayer();
  251.     virtual void Enter();
  252.     virtual void Exit();
  253.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  254. private:
  255.     void Player(void);
  256.     void CreatePlayerScreenUI(void);
  257.     void HandlerCameraOrientation(StringHash eventType, VariantMap& eventData);
  258.     void CameraOrientationRotateMove (float degrees, int movement);
  259.     void HandleMouseReleased(StringHash eventType, VariantMap& eventData);
  260.     void CreatePlayerUIHandleClosePressed(StringHash eventType, VariantMap& eventData);
  261.     void loadSceneCreationCreation(const char * lineinput);
  262.     void CreatePlayerUIHandleControlClicked(StringHash eventType, VariantMap& eventData);
  263.     void HandlePersonalitySelectionItemClick(StringHash eventType, VariantMap& eventData);
  264. protected:
  265.  
  266. };
  267.  
  268. /// Main Screen State
  269. class ExistenceClientStateProgress :public ExistenceClientStateSingleton
  270. {
  271.     OBJECT(ExistenceClientStateProgress);
  272. public:
  273.     ExistenceClientStateProgress(Context * context);
  274.     virtual ~ExistenceClientStateProgress();
  275.     virtual void Enter();
  276.     virtual void Exit();
  277.     virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
  278. private:
  279.     void Progress(void);
  280.     void ProgressScreenUI(void);
  281.     void ProgressScreenUIHandleClosePressed(StringHash eventType, VariantMap& eventData);
  282.     void CreateCharacter(void);
  283.     void GenerateScene(terrain_rule terrainrule,const char *differentialfilename);
  284.     int GenerateSceneBuildWorld(terrain_rule terrainrule);
  285.     void loadDummyScene(void);
  286.     void loadScene(const int mode, const char * lineinput);
  287. protected:
  288.  
  289. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement