-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathViewModel.h
More file actions
149 lines (105 loc) · 2.77 KB
/
Copy pathViewModel.h
File metadata and controls
149 lines (105 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#pragma once
#include <string>
#include <vector>
#include <memory>
#include "PartyViewModel.h"
#include "GameSessionViewModel.h"
#include "GameFinderViewModel.h"
#include "FriendsViewModel.h"
#include "LogsUI.h"
#if defined(ENABLE_EPIC)
#include "eos_init.h"
class EpicSettingsviewModel
{
public:
bool enabled = false;
std::string productName = "Sample-cpp-Epic";
std::string productVersion = "0.1";
std::string loginMode = "DevAuth";
std::string devAuthHost = "localhost:8888";
std::string devAuthCredentialsName = "MyName";
std::string productId = "0123456789abcdef0123456789abcdef";
std::string sandboxId = "0123456789abcdef0123456789abcdef";
std::string deploymentId = "0123456789abcdef0123456789abcdef";
std::string clientId = "ZWirRLAaSjGsO3aCNbokY05JgPou53fO";
std::string clientSecret = "NXtiEGDaQY769e9Ms5uF1X8s/TN6IEWn0fhsETfUEx0";
};
#endif
class AppViewModel;
class SettingsViewModel
{
public:
SettingsViewModel(AppViewModel* parent);
std::string endpoint;
std::string account;
std::string application;
std::string gameVersion;
std::string gameFinderName;
#if defined(ENABLE_EPIC)
EpicSettingsviewModel epicSettings;
#endif
void load();
void save();
AppViewModel* parent;
};
class ClientViewModel
{
public:
ClientViewModel(int id, AppViewModel* parent);
ClientViewModel(ClientViewModel& v) = delete;
~ClientViewModel();
int id = 0;
bool isProcessing = false;
std::string lastError;
bool running = true;
std::string deviceIdentifier;
std::string authenticationProvider = "ephemeral";
std::vector<std::string> authenticationProviders;
std::string getServerApp();
float deltaTime = 1.0f/60;
//AUTH
void connect();
void disconnect();
AppViewModel* parent;
PartyViewModel party;
GameSessionViewModel gameSession;
GameFinderViewModel gameFinder;
FriendsViewModel friends;
bool showLogsWindow = false;
LogsComponent logs;
const char* getConnectionStatus() const;
std::string getSessionId() const;
private:
std::shared_ptr<Logger> _logger;
Stormancer::Subscription _partyInvitationSubscription;
};
class AppViewModel
{
public:
AppViewModel()
:settings(SettingsViewModel(this))
{}
#if defined(ENABLE_EPIC)
~AppViewModel()
{
if (this->epicPlatformHandle)
{
EOS_Platform_Release(this->epicPlatformHandle);
}
}
#endif
bool showSettingsWindow = false;
bool showDemoWindow = false;
#if defined(ENABLE_EPIC)
char* epicDevAuthCredentialsName = nullptr;
EOS_HPlatform epicPlatformHandle = nullptr;
#endif
SettingsViewModel settings;
std::shared_ptr<Stormancer::MainThreadActionDispatcher> actionDispatcher = std::make_shared<Stormancer::MainThreadActionDispatcher>();
int nextClientId = 0;
std::vector<std::shared_ptr<ClientViewModel>> clients;
bool addClientCmd = false;
void tick();
private:
void addClient();
};