コード例 #1
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin(new[] { "pal-chemistry.bin" }));
 }
コード例 #2
0
 public GetVideoChunkFunc    getVideoChunkFunc()
 {
     return(SharedUtils.getVideoChunk("chr1.bin"));
 }
コード例 #3
0
 public GetVideoChunkFunc    getVideoChunkFunc()
 {
     return(SharedUtils.getVideoChunk(new[] { "chr7-1.bin" }));
 }
コード例 #4
0
 public GetVideoChunkFunc    getVideoChunkFunc()
 {
     return(SharedUtils.getVideoChunk(new[] { "chr1(b).bin", "chr1(e).bin" }));
 }
コード例 #5
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin(new[] { "pal1-4(a).bin" }));
 }
コード例 #6
0
        public override void Start()
        {
            base.Start();

            Debug.Log("Player controller start");

            if (!CameraRoot)
            {
                CameraRoot = transform.Find("CameraRoot");
            }

            if (!ModelRoot)
            {
                ModelRoot = transform.GetChild(0).gameObject;
            }

            if (!MovementComponent)
            {
                MovementComponent = GetComponent <PlayerMovementComponent>();
            }

            if (!WeaponComponent)
            {
                WeaponComponent = GetComponentInChildren <PlayerWeaponComponent>();
            }

            if (!CameraZoomComponent)
            {
                CameraZoomComponent = GetComponentInChildren <PlayerCameraZoomComponent>(true);
            }

            if (!DeathComponent)
            {
                DeathComponent = GetComponentInChildren <PlayerDeathComponent>();
            }

            if (!ShieldComponent)
            {
                ShieldComponent = GetComponent <PlayerShieldComponent>();
            }

            if (LightReportingComponent == null)
            {
                LightReportingComponent = GetComponentInChildren <IReportLight>() as MonoBehaviour;
            }

            if (!HUDScript)
            {
                HUDScript = SharedUtils.TryGetHudController() as RpgHUDController;
            }

            if (!HUDScript && AutoinitHud)
            {
                Instantiate <GameObject>(CoreUtils.LoadResource <GameObject>("UI/DefaultWorldHUD"), CoreUtils.GetUIRoot());
                if (EventSystem.current == null)
                {
                    Instantiate(CoreUtils.LoadResource <GameObject>("UI/DefaultEventSystem"));
                }

                HUDScript = SharedUtils.TryGetHudController() as RpgHUDController;
                if (HUDScript == null)
                {
                    Debug.LogError("[PlayerController] Failed to initialize HUD properly");
                }
            }

            MessageInterface = new QdmsMessageInterface(gameObject);

            LockPauseModule.CaptureMouse = true;

            SetDefaultPlayerView();
            SetInitialViewModels();

            ShieldComponent.Ref()?.HandleLoadStart();

            TryExecuteOnComponents(component => component.Init(this));
            Initialized = true;
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: romanwue/TimeStampClient
 private void GenerateNonceBytesOnClick(object sender, EventArgs e)
 {
     this.Nonce.Text = SharedUtils.BytesToHexString(SharedUtils.GenerateNonceBytes());
 }
コード例 #8
0
ファイル: SaveUtils.cs プロジェクト: XCVG/heavymetalslug
        /// <summary>
        /// Creates an autosave
        /// </summary>
        public static void DoAutoSave(bool force)
        {
            if (!CoreParams.AllowSaveLoad)
            {
                if (force) //you are not allowed to force a save if it's globally disabled; the assumption is that if it's globally disabled, it won't work at all
                {
                    throw new NotSupportedException("Save/Load is disabled in core params!");
                }

                throw new SaveNotAllowedException();
            }

            if (GameState.Instance.SaveLocked && !force)
            {
                throw new SaveNotAllowedException(); //don't autosave if we're not allowed to
            }
            if (ConfigState.Instance.AutosaveCount <= 0 && !force)
            {
                throw new SaveNotAllowedException(); //don't autosave if we've disabled it
            }
            //autosave format will be a_<hash>_<index>
            //since we aren't supporting campaign-unique autosaves, yet, hash will just be 0
            string campaignId   = "0";
            string filterString = $"a_{campaignId}_";

            string        savePath  = CoreParams.SavePath;
            DirectoryInfo saveDInfo = new DirectoryInfo(savePath);

            FileInfo[] savesFInfo = saveDInfo.GetFiles().Where(f => f.Name.StartsWith(filterString)).OrderBy(f => f.Name).Reverse().ToArray();

            //Debug.Log(savesFInfo.Select(f => f.Name).ToNiceString());

            int highestSaveId = 1;

            foreach (var saveFI in savesFInfo)
            {
                try
                {
                    var nameParts = Path.GetFileNameWithoutExtension(saveFI.Name).Split('_');
                    int saveId    = int.Parse(nameParts[2]);
                    if (saveId > highestSaveId)
                    {
                        highestSaveId = saveId;
                    }
                }
                catch (Exception)
                {
                    Debug.LogError($"Found an invalid save file: {saveFI.Name}");
                }
            }

            //save this autosave
            string newSaveName = $"a_{campaignId}_{highestSaveId + 1}.json";

            SharedUtils.SaveGame(newSaveName, false);

            //remove old autosaves
            int numAutosaves = savesFInfo.Length + 1;

            for (int i = savesFInfo.Length - 1; i >= 0 && numAutosaves > ConfigState.Instance.AutosaveCount; i--)
            {
                var saveFI = savesFInfo[i];
                try
                {
                    File.Delete(Path.Combine(CoreParams.SavePath, saveFI.Name));
                    numAutosaves--;
                }
                catch (Exception)
                {
                    Debug.LogError($"Failed to delete save file: {saveFI.Name}");
                }
            }

            Debug.Log($"Autosave complete ({newSaveName})");
        }
コード例 #9
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin(new[] { "pal7-egypt1.bin" }));
 }
コード例 #10
0
        public static void Main(string[] args)
        {
            try
            {
                string fileName          = null;
                string tsa               = null;
                string hash              = null;
                string policy            = null;
                string nonce             = null;
                bool   cert              = false;
                string outFile           = null;
                string sslClientCertFile = null;
                string sslClientCertPass = null;
                string httpAuthLogin     = null;
                string httpAuthPass      = null;
                bool   isAsics           = false;

                if (args == null)
                {
                    return;
                }

                int i = 0;
                if (0 >= args.Length)
                {
                    ExitWithHelp(string.Empty);
                }

                while (i < args.Length)
                {
                    switch (args[i])
                    {
                    case "--file":
                        fileName = args[++i];
                        break;

                    case "--tsa":
                        tsa = args[++i];
                        break;

                    case "--out":
                        outFile = args[++i];
                        break;

                    case "--hash":
                        hash = args[++i];
                        break;

                    case "--policy":
                        policy = args[++i];
                        break;

                    case "--nonce":
                        nonce = args[++i];
                        break;

                    case "--cert-req":
                        cert = true;
                        break;

                    case "--asics":
                        isAsics = true;
                        break;

                    case "--ssl-client-cert-file":
                        sslClientCertFile = args[++i];
                        break;

                    case "--ssl-client-cert-pass":
                        sslClientCertPass = args[++i];
                        break;

                    case "--http-auth-login":
                        httpAuthLogin = args[++i];
                        break;

                    case "--http-auth-pass":
                        httpAuthPass = args[++i];
                        break;

                    default:
                        ExitWithHelp("Invalid argument: " + args[i]);
                        break;
                    }

                    i++;
                }

                X509Certificate2 sslCert = null;
                if (!string.IsNullOrEmpty(sslClientCertFile))
                {
                    sslCert = new X509Certificate2(sslClientCertFile, sslClientCertPass);
                }

                NetworkCredential networkCredential = null;
                if (!string.IsNullOrEmpty(httpAuthLogin) && !string.IsNullOrEmpty(httpAuthPass))
                {
                    networkCredential = new NetworkCredential(httpAuthLogin, httpAuthPass);
                }

                UserCredentials credentials = null;
                if (networkCredential != null || sslCert != null)
                {
                    credentials = new UserCredentials(sslCert, networkCredential);
                }

                TimeStampToken token = SharedUtils.RequestTimeStamp(tsa, fileName, hash, policy, nonce, cert, credentials, new LogDelegate(LogMessage), true);
                if (isAsics)
                {
                    SharedUtils.SaveToAsicSimple(fileName, token, outFile);
                }
                else
                {
                    SharedUtils.SaveResponse(outFile, token);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ExitWithHelp(null);
            }

            Console.WriteLine("Success");
        }
コード例 #11
0
 public GetPalFunc           getPalFunc()           { return SharedUtils.readPalFromBin(new[] {"pal7-2.bin"}); }
コード例 #12
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin(new[] { "pal6_000.bin", "pal6_001.bin", "pal6_002.bin", "pal6_003.bin" }));
 }
コード例 #13
0
 public GetVideoChunkFunc    getVideoChunkFunc()
 {
     return(SharedUtils.getVideoChunk(new[] { "chr6_000.bin", "chr6_001.bin", "chr6_002.bin", "chr6_003.bin", "chr6_004.bin" }));
 }
コード例 #14
0
 public GetVideoChunkFunc    getVideoChunkFunc()
 {
     return(SharedUtils.getVideoChunk(new[] { "chr3-2(bonus).bin" }));
 }
コード例 #15
0
 static void Load(string name)
 {
     SharedUtils.LoadGame(name, true);
 }
コード例 #16
0
 public void StartGame()
 {
     //start a new game the normal way
     SharedUtils.StartGame();
 }
コード例 #17
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin(new[] { "pal4-1(a).bin", "pal4-1(b).bin", "pal4-1(d).bin" }));
 }
コード例 #18
0
 public void OnClickContinue()
 {
     SharedUtils.LoadGame(SaveUtils.GetLastSave(), false);
 }
コード例 #19
0
        private async Task LoadSettings()
        {
            RetryButtonIsVisible           = false;
            App.Settings.ConnectionDetails = new ConnectionDetails
            {
                PortNo = 8096
            };

            var doNotShowFirstRun = _applicationSettings.Get(Constants.Settings.DoNotShowFirstRun, false);

            if (!doNotShowFirstRun)
            {
                NavigationService.NavigateTo(Constants.Pages.FirstRun.WelcomeView);
                return;
            }

            SetProgressBar(AppResources.SysTrayLoadingSettings);

#if !DEBUG
            //try
            //{
            //    if (!ApplicationManifest.Current.App.Title.ToLower().Contains("beta"))
            //    {
            //        var marketPlace = new MarketplaceInformationService();
            //        var appInfo = await marketPlace.GetAppInformationAsync(ApplicationManifest.Current.App.ProductId);

            //        if (new Version(appInfo.Entry.Version) > new Version(ApplicationManifest.Current.App.Version) &&
            //            MessageBox.Show("There is a newer version, would you like to install it now?", "Update Available", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            //        {
            //            new MarketplaceDetailService().Show();
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Log.ErrorException("GetAppInformationAsync()", ex);
            //}
#endif
            // Get and set the app specific settings
            _specificSettings = _applicationSettings.Get <SpecificSettings>(Constants.Settings.SpecificSettings);
            if (_specificSettings != null)
            {
                SharedUtils.CopyItem(_specificSettings, App.SpecificSettings);
            }

            SetRunUnderLock();

            _uploadSettings = _applicationSettings.Get <UploadSettings>(Constants.Settings.PhotoUploadSettings);
            if (_uploadSettings != null)
            {
                SharedUtils.CopyItem(_uploadSettings, App.UploadSettings);
            }

            _connectionDetails = _applicationSettings.Get <ConnectionDetails>(Constants.Settings.ConnectionSettings);
            _savedServer       = _applicationSettings.Get <ServerInfo>(Constants.Settings.DefaultServerConnection);

            if (_savedServer != null)
            {
                _serverInfo.SetServerInfo(_savedServer);
            }
            else
            {
                NavigationService.NavigateTo(Constants.Pages.FirstRun.WelcomeView);
                return;
            }

            await ConnectToServer();
        }
コード例 #20
0
    static void Commit()
    {
        BaseSceneController bsc = SharedUtils.GetSceneController();

        bsc.Commit();
    }
コード例 #21
0
        public Task <int> Execute()
        {
            return(ConsoleTask.ExecuteAsync(this, async(console) =>
            {
                console.WriteLine("Connecting to innovator...");
                var conn = await this.GetConnection().ConfigureAwait(false);
                var processor = new ExportProcessor(conn);

                var refsToExport = default(List <ItemReference>);
                var checkDependencies = true;

                console.Write("Identifying items to export... ");
                if (this.InputFile?.EndsWith(".innpkg", StringComparison.OrdinalIgnoreCase) == true ||
                    this.InputFile?.EndsWith(".mf", StringComparison.OrdinalIgnoreCase) == true)
                {
                    var exportScript = InnovatorPackage.Load(this.InputFile).Read();
                    refsToExport = exportScript.Lines
                                   .Where(l => l.Type == InstallType.Create)
                                   .Select(l => l.Reference)
                                   .Distinct()
                                   .ToList();
                }
                else
                {
                    var exportQuery = XElement.Parse("<AML><Item type='*' /></AML>");
                    if (!string.IsNullOrEmpty(this.InputFile))
                    {
                        exportQuery = XElement.Load(this.InputFile);
                    }

                    var firstItem = exportQuery.XPathSelectElement("//Item[1]");
                    if (firstItem == null)
                    {
                        throw new Exception("No item nodes could be found");
                    }

                    var items = default(IEnumerable <XElement>);
                    if (firstItem.Parent == null)
                    {
                        items = new[] { firstItem }
                    }
                    ;
                    else
                    {
                        items = firstItem.Parent.Elements("Item");
                    }

                    var version = await conn.FetchVersion(true).ConfigureAwait(false);
                    var types = ExportAllType.Types.Where(t => t.Applies(version)).ToList();
                    var queries = GetQueryies(items, types).ToList();
                    checkDependencies = items.All(e => e.Attribute("type")?.Value != "*");

                    using (var prog = console.Progress())
                    {
                        var toExport = await SharedUtils.TaskPool(30, (l, m) => prog.Report(l / 100.0), queries
                                                                  .Select(q =>
                        {
                            var aml = new XElement(q);
                            var levels = aml.Attribute("levels");
                            if (levels != null)
                            {
                                levels.Remove();
                            }
                            return (Func <Task <QueryAndResult> >)(() => conn.ApplyAsync(aml, true, false)
                                                                   .ToTask()
                                                                   .ContinueWith(t => new QueryAndResult()
                            {
                                Query = q,
                                Result = t.Result
                            }));
                        })
                                                                  .ToArray());
                        refsToExport = toExport.SelectMany(r =>
                        {
                            var refs = r.Result.Items()
                                       .Select(i => ItemReference.FromFullItem(i, true))
                                       .ToList();
                            var levels = (int?)r.Query.Attribute("levels");
                            if (levels.HasValue)
                            {
                                foreach (var iRef in refs)
                                {
                                    iRef.Levels = levels.Value;
                                }
                            }
                            return refs;
                        })
                                       .Distinct()
                                       .ToList();
                    }
                }
                console.WriteLine("Done.");

                var script = new InstallScript
                {
                    ExportUri = new Uri(Url),
                    ExportDb = Database,
                    Lines = Enumerable.Empty <InstallItem>(),
                    Title = Title ?? System.IO.Path.GetFileNameWithoutExtension(Output),
                    Creator = Author ?? Username,
                    Website = string.IsNullOrEmpty(Website) ? null : new Uri(Website),
                    Description = Description,
                    Created = DateTime.Now,
                    Modified = DateTime.Now
                };

                console.Write("Exporting metadata... ");
                using (var prog = console.Progress())
                {
                    processor.ProgressChanged += (s, e) => prog.Report(e.Progress / 100.0);
                    processor.ActionComplete += (s, e) =>
                    {
                        if (e.Exception != null)
                        {
                            throw new AggregateException(e.Exception);
                        }
                    };
                    await processor.Export(script, refsToExport, checkDependencies);
                }
                console.WriteLine("Done.");

                WritePackage(console, script, Output, MultipleDirectories, CleanOutput);
            }));
        }
コード例 #22
0
 static void Save(string name)
 {
     SharedUtils.SaveGame(name, true, true);
 }
コード例 #23
0
 /// <summary>
 /// Map from a distance to a distance code.
 /// </summary>
 /// <remarks>
 /// No side effects. _dist_code[256] and _dist_code[257] are never used.
 /// </remarks>
 internal static int DistanceCode(int dist)
 {
     return((dist < 256)
         ? _dist_code[dist]
         : _dist_code[256 + SharedUtils.URShift(dist, 7)]);
 }
コード例 #24
0
 static void Warp(string scene)
 {
     SharedUtils.ChangeScene(scene);
 }
コード例 #25
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin("pal1-3.bin"));
 }
コード例 #26
0
 static void Reload()
 {
     SharedUtils.ChangeScene(SceneManager.GetActiveScene().name);
 }
コード例 #27
0
 public GetVideoPageAddrFunc getVideoPageAddrFunc()
 {
     return(SharedUtils.fakeVideoAddr());
 }
コード例 #28
0
 static void EndGame()
 {
     SharedUtils.EndGame();
 }
コード例 #29
0
 public GetPalFunc           getPalFunc()
 {
     return(SharedUtils.readPalFromBin(new[] { "pal3.bin", "pal3-2.bin" }));
 }
コード例 #30
0
 public GetVideoChunkFunc    getVideoChunkFunc()
 {
     return(SharedUtils.getVideoChunk(new[] { "chr-chemistry.bin" }));
 }