Exemplo n.º 1
0
        private static void OnGameFinish(Result <ExitStatus, TimeSpan, GClass_GameFinish> result)
        {
            GInterface22    backend         = ClientAppUtils.GetBackendSession();
            MainApplication mainApplication = MainAppUtils.GetMainApp();

            if (backend?.Profile == null || mainApplication == null)
            {
                _gameCallBack(result);
                return;
            }

            ESideType?eSideType = PrivateValueAccessor.GetPrivateFieldValue(mainApplication.GetType(),
                                                                            "esideType_0", mainApplication) as ESideType?;
            Profile profile      = backend.Profile;
            bool    isPlayerScav = false;

            if (eSideType != null && eSideType.GetValueOrDefault() == ESideType.Savage)
            {
                profile      = backend.ProfileOfPet;
                isPlayerScav = true;
            }

            try
            {
                CreatePlayerOwnerMonitor.Catched = false;
                ProfileSaveUtil.SaveProfileProgress(profile, result.Value0, backend.GetPhpSessionId(), isPlayerScav);
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            _gameCallBack(result);
        }
Exemplo n.º 2
0
        private static void OnGameFinish(Result <ExitStatus, TimeSpan, GameFinish> result)
        {
            MainApplication mainApplication = ClientAppUtils.GetMainApp();
            ISession        session         = ClientAppUtils.GetBackendSession();
            string          backendUrl      = ClientConfig.Config.BackendUrl;

            if (session?.Profile == null || mainApplication == null)
            {
                _gameCallBack(result);
                return;
            }

            ESideType?eSideType    = PrivateValueAccessor.GetPrivateFieldValue(mainApplication.GetType(), "esideType_0", mainApplication) as ESideType?;
            Profile   profile      = session.Profile;
            bool      isPlayerScav = false;

            if (eSideType != null && eSideType.GetValueOrDefault() == ESideType.Savage)
            {
                profile      = session.ProfileOfPet;
                isPlayerScav = true;
            }

            try
            {
                SaveLootUtil.SaveProfileProgress(backendUrl, session.GetPhpSessionId(), result.Value0, profile, isPlayerScav);
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            _gameCallBack(result);
        }