public override void Initialize(ItemLocationMap _, GCM gameContentManager) { GameContentManager = gameContentManager; var saveFile = (GameSave)Dynamic.SaveFile; var seed = saveFile.GetSeed(); var fillingMethod = saveFile.GetFillingMethod(); if (!seed.HasValue) { seed = Seed.Zero; } Console.Out.WriteLine($"Seed: {seed}"); seedOptions = seed.Value.Options; ItemLocations = Randomizer.Randomize(seed.Value, fillingMethod); ItemLocations.BaseOnSave(Level.GameSave); ItemTrackerUplink.UpdateState(ItemTrackerState.FromItemLocationMap(ItemLocations)); LevelReflected._random = new DeRandomizer(LevelReflected._random, seed.Value); ItemManipulator.Initialize(ItemLocations); }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { var hud = ((object)Dynamic._minimapHud).AsDynamic(); hud._minimap = DeepClone(Dynamic._minimap); itemLocations = itemLocationMap; Dynamic._removeMarkerText = (string)Dynamic._removeMarkerText + " / Show where to go next"; foreach (var roomkey in DisabledCheckpoints) { foreach (var block in GetRoom(roomkey).Blocks.Values) { block.IsCheckpoint = false; } } foreach (var roomkey in BossRooms) { foreach (var block in GetRoom(roomkey).Blocks.Values) { block.IsBoss = true; } } }
/// <summary> /// Hàm chạy ngay khi GameManager được khởi tạo /// </summary> void Init() { #if UNITY_WEBPLAYER if (!Security.PrefetchSocketPolicy(CServer.HOST_NAME, System.Convert.ToInt32(CServer.PORT), 999)) { Debug.LogError("Security Exception. Policy file load failed!"); } #elif UNITY_ANDROID GCM.Register(GCM.SENDER_IDS); #elif UNITY_IPHONE EtceteraBinding.registerForRemoteNotifcations(P31RemoteNotificationType.Alert | P31RemoteNotificationType.Badge | P31RemoteNotificationType.Sound); #endif Debug.LogWarning("GameManager: Init()"); mInfo = new User(); channelRoom = new RoomInfo(); currentRoom = new RoomInfo(); selectedChannel = new RoomInfo(); selectedLobby = new RoomInfo(); Setting.Init(); applicationStart = new ApplicationStart(); #if UNITY_ANDROID || UNITY_IPHONE if (!FB.IsLoggedIn) { FB.Init(onInitComplete, onHideUnity); } #endif }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { if (!IsUsedAsSeedSelectionMenu) { return; } gcm = gameContentManager; Dynamic._menuTitle = "Select Seed"; Dynamic._displayCharacters = new string[Seed.Length]; Dynamic._displayCharacterOrigins = new Vector2[Seed.Length]; okButton = MenuEntry.Create("OK", OnOkayEntrySelected); ChangeAvailableButtons( MenuEntry.Create("DEL", OnDeleteCharacter), okButton, MenuEntry.Create("", () => { }, false), MenuEntry.Create("New", OnGenerateSelected), MenuEntry.Create("Flags", OnOptionsSelected), MenuEntry.Create("", () => { }, false), MenuEntry.Create("Settings", OnSettingsSelected) ); }
private void closeToolStripMenuItem_Click(object sender, EventArgs e) { GCM = null; GCMFilePath = null; treeView1.Nodes.Clear(); }
private void CreateAndroidInstalliation() { const string ProjectID = "1234567890"; //replace with yours GCM.SetRegisteredCallback(registrationId => { Debug.Log("Parse notification Registered: " + registrationId); var obj = CreateInstallationObject(registrationId, "android"); obj["pushType"] = "gcm"; obj["GCMSenderId"] = ProjectID; obj.SaveAsync().ContinueWith(t => { if (t.IsFaulted) { Debug.LogError("error on parse push installiation "); } else if (obj.ObjectId != null) { PlayerPrefs.SetString("currentInstallation", obj.ObjectId); } }); }); string[] senderIds = { ProjectID }; GCM.Register(senderIds); }
public SeedRepresentation(Seed?seed, GCM gcm, bool drawBackdrop = true) { this.seed = seed; this.gcm = gcm; this.drawBackdrop = drawBackdrop; menuIcons = (SpriteSheet)gcm.AsDynamic().Get("Sprites/Items/MenuIcons"); }
public GameConsole(ScreenManager screenManager, GCM gcm) { this.screenManager = screenManager; this.gcm = gcm; AddCommand(new HelpCommand()); }
/// <summary> /// Registers device to receive remote notifications from GCM. /// </summary> public void Register() { GCM.SetRegisteredCallback(OnDeviceRegistered); GCM.SetMessageCallback(OnReceivedMessage); GCM.Register(new string[] { "1064222689329" }); }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { var randomizerVersion = Assembly.GetExecutingAssembly().GetName().Version; var newVersionString = $"TsRandomizer: v{randomizerVersion}, Timespinner: {Dynamic._versionNumber}"; Dynamic._versionNumber = newVersionString; Dynamic.RefreshSizes(); }
public Log(GCM gcm) { this.gcm = gcm; SetSettings(GameSettingsLoader.LoadSettingsFromFile()); Add(this); }
public GCMNode(GCM GCM, string FileName) { this.GCM = GCM; Text = Path.GetFileName(FileName); ImageIndex = 0; SelectedImageIndex = 0; }
public TrackerRenderer(GCM gcm, ContentManager contentManager) { menuIcons = (SpriteSheet)gcm.AsDynamic().Get("Sprites/Items/MenuIcons", contentManager); var numberOfFireSourcesCombined = 4; var numberOfPinkSourcesCombined = 3; numberOfItems = ItemTrackerState.NumberOfItems - (numberOfFireSourcesCombined - 1) - (numberOfPinkSourcesCombined - 1); }
private void Awake() { GCM.Initialize(); //create GCMReceiver // Set callbacks GCM.SetErrorCallback(errorId => Debug.Log("Parse notification error: " + errorId)); GCM.SetUnregisteredCallback(registrationId => Debug.Log("Parse notification Unregistered: " + registrationId)); GCM.SetDeleteMessagesCallback(total => Debug.Log("Parse notification DeleteMessages " + total)); GCM.SetMessageCallback(HandleMessage); }
/// <summary> /// Callback used when device is successfully registered with GCM. Sends data do PlayFab. /// </summary> /// <param name="registrationID">Registration ID.</param> void OnDeviceRegistered(string registrationID) { GCM.SetNotificationsEnabled(true); AndroidDevicePushNotificationRegistrationRequest request = new AndroidDevicePushNotificationRegistrationRequest(); request.DeviceToken = registrationID; request.SendPushNotificationConfirmation = true; PlayFabClientAPI.AndroidDevicePushNotificationRegistration(request, OnRegisteredForPushNotification, OnRegisterForPushNotificationError); }
static void SetColor(GCM gameContentManager, Rectangle target, Color color) { var colorData = new Color[target.Width * target.Height]; for (int i = 0; i < colorData.Length; i++) { colorData[i] = color; } gameContentManager.SpMiniMap.Texture.SetData(0, target, colorData, 0, target.Width * target.Height); }
public void Save(GCM oGCM) { if (_oTourerContext.GCMs.Where(g => g.GCMNo == oGCM.GCMNo && g.UserID == oGCM.UserID).Any()) { return; } else { _oTourerContext.GCMs.Add(oGCM); _oTourerContext.SaveChanges(); } }
public static void UpdateMinimapColors(this GCM gameContentManager, SettingCollection settings) { SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.Blue], settings.PastMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.Purple], settings.PresentMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.Green], settings.PyramidMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.Orange], settings.LootMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.Red], settings.SaveStatueMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.Yellow], settings.SpecailLootMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.SpecialBlue], settings.PresentTransitionMinimapColor.Color); SetColor(gameContentManager, ColorPositions[EMinimapRoomColor.SpecialPurple], settings.PastTransitionMinimapColor.Color); }
public BackgroundRenderer(GCM gcm, ContentManager contentManager) { var blank = contentManager.Load <Texture2D>("Overlays/BlankSquare"); var pauseMenu = (SpriteSheet)gcm.AsDynamic().Get("Overlays/Menu/PauseMenu", contentManager); backgrounds = new[] { new Background { Texture = blank, Color = Color.WhiteSmoke }, new Background { Texture = blank, Color = Color.BlueViolet }, new Background { Texture = blank, Color = Color.Pink }, new Background { Texture = blank, Color = Color.IndianRed }, new Background { Texture = blank, Color = Color.DarkGray }, new Background { Texture = blank, Color = Color.Goldenrod }, new Background { Texture = blank, Color = Color.GreenYellow }, new Background { Texture = blank, Color = Color.DarkKhaki }, new Background { Texture = blank, Color = new Color(new Vector3(1, 0, 1)) }, new Background { Texture = blank, Color = new Color(new Vector3(1, 1, 0)) }, new Background { Texture = blank, Color = new Color(new Vector3(0, 1, 1)) }, new Background { Texture = pauseMenu.Texture, Souce = new Rectangle(48, 112, 16, 16), Color = Color.White }, new Background { Texture = pauseMenu.Texture, Souce = new Rectangle(48, 96, 16, 16), Color = Color.White }, new Background { Texture = pauseMenu.Texture, Souce = new Rectangle(112, 96, 16, 16), Color = Color.White }, }; }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { if (!ConnectCommand.IsWaitingForDifficulty) { SetSelectedMenuItemByIndex(0); } else { SetSeedAndFillingMethod(ConnectCommand.Seed, FillingMethod.Archipelago, ConnectCommand.Settings); HookOnDifficultySelected(ConnectCommand.OnDifficultySelectedHook); ConnectCommand.IsWaitingForDifficulty = false; } }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { Action <GameSave> originalReloadSaveAction = Dynamic._reloadSaveAction; void ReloadSave(GameSave gameSave) { itemLocationMap.Initialize(gameSave); ItemTrackerUplink.UpdateState(ItemTrackerState.FromItemLocationMap(itemLocationMap)); originalReloadSaveAction(gameSave); } Dynamic._reloadSaveAction = (Action <GameSave>)ReloadSave; }
public bool Save(GCM oGCM, int userID) { try { _GCM.GCMNo = oGCM.GCMNo; _GCM.UserID = userID; SetCommonField(false); _GCMDA.Save(_GCM); return(true); } catch (Exception) { return(false); } }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { if (!IsUsedAsArchipelagoSelectionMenu) { return; } Dynamic._menuTitle = "Enter Credentials"; serverMenuEntry = MenuEntry.Create(ServerPrefix, _ => { }); userMenuEntry = MenuEntry.Create(UserPrefix, _ => { }); passwordMenuEntry = MenuEntry.Create(PasswordPrefix, _ => { }); connectMenuEntry = MenuEntry.Create("Connect", OnConnectEntrySelected, false); ChangeAvailableButtons(serverMenuEntry, userMenuEntry, passwordMenuEntry, connectMenuEntry); }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { if (!IsUsedAsSeedSelectionMenu) { return; } Dynamic._menuTitle = "Select Seed"; okButton = MenuEntry.Create("OK", OnOkayEntrySelected); ChangeAvailableButtons( okButton, MenuEntry.Create("", () => { }, false), MenuEntry.Create("New", OnGenerateSelected), MenuEntry.Create("Options", OnOptionsSelected) ); }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { if (!IsUsedAsSeedOptionsMenu) { return; } Dynamic._menuTitle = "Select Seed Options"; var relicInventory = ((object)Dynamic._relicInventory).AsDynamic(); relicInventory.ColumnCount = 1; relicInventory.SetColumnWidth(226 * Dynamic.Zoom, Dynamic.Zoom); HookOnSelectedAction(relicInventory); UpdateMenuItems(Dynamic._relicInventory); }
public static GameScreen Create(ScreenManager screenManager) { GCM gcm = screenManager.AsDynamic().GCM; void Noop() { var gameplayScreen = screenManager.FirstOrDefault <GameplayScreen>(); if (gameplayScreen != null && gameplayScreen.Settings != null) { gcm.UpdateMinimapColors(gameplayScreen.Settings); } } gcm.LoadAllResources(screenManager.AsDynamic().GeneralContentManager, screenManager.GraphicsDevice); return((GameScreen)Activator.CreateInstance(JournalMenuType, GameSave.DemoSave, gcm, (Action)Noop)); }
public override void Initialize(ItemLocationMap itemLocationMap, GCM gameContentManager) { gcm = gameContentManager; if (!IsUsedAsGameSettingsMenu) { return; } Dynamic._menuTitle = "Game Settings"; var gameplayScreen = ScreenManager.FirstOrDefault <GameplayScreen>(); save = gameplayScreen?.Save; settings = IsInGame ? gameplayScreen.Settings : GameSettingsLoader.LoadSettingsFromFile(); ResetMenu(); }
// Use this for initialization void Start() { // Create receiver game object GCM.Initialize(); // Set callbacks GCM.SetErrorCallback((string errorId) => { Debug.Log("Error!!! " + errorId); GCM.ShowToast("Error!!!"); _text = "Error: " + errorId; }); GCM.SetMessageCallback((Dictionary <string, object> table) => { Debug.Log("Message!!!"); GCM.ShowToast("Message!!!"); _text = "Message: " + System.Environment.NewLine; foreach (var key in table.Keys) { _text += key + "=" + table[key] + System.Environment.NewLine; } }); GCM.SetRegisteredCallback((string registrationId) => { Debug.Log("Registered!!! " + registrationId); GCM.ShowToast("Registered!!!"); _text = "Register: " + registrationId; }); GCM.SetUnregisteredCallback((string registrationId) => { Debug.Log("Unregistered!!! " + registrationId); GCM.ShowToast("Unregistered!!!"); _text = "Unregister: " + registrationId; }); GCM.SetDeleteMessagesCallback((int total) => { Debug.Log("DeleteMessages!!! " + total); GCM.ShowToast("DeleteMessaged!!!"); _text = "DeleteMessages: " + total; }); }
private void OpenGCM(string FileName) { GCMFilePath = FileName; // Read file using (Stream GCMStream = OpenGCMStream()) { GCM = new GCM(GCMStream); } // Add to recent file list RecentFileList.AddFile(FileName); RecentFileList.SaveToDisk(); // Create tree nodes GCMNode Root = GCM.CreateTreeNode(FileName); treeView1.Nodes.Clear(); treeView1.Nodes.Add(Root); SetContextMenuStrip(Root); }
public void EncryptionTest() { // Create RSA Keys RSA rsa = new RSA(RSA.KEY_SIZE); string pubKey = TextConversion.Base64Encode(rsa.GetPublicKey()); string privKey = TextConversion.Base64Encode(rsa.GetPrivateKey()); byte[] dataToEncrypt = new byte[300]; RandomNumberGenerator.Fill(dataToEncrypt); // Create AES Keys byte[] key = new byte[16]; RandomNumberGenerator.Fill(key); byte[] aad = new byte[32]; RandomNumberGenerator.Fill(aad); // SECURE GCM Key // Encrypt Key for AES with RSA and check if given and decrypted keys are equal byte[] encryptedAeskey = RSA.EncryptBytes(key, RSA.SetKeyFromString(pubKey)); byte[] decryptedAesKey = RSA.DecryptBytes(encryptedAeskey, RSA.SetKeyFromString(privKey)); Assert.IsTrue(key.SequenceEqual(decryptedAesKey)); // ENCRYPT DATA // Encrypt with key and decrypt with DecryptedAesKey byte[] encryptedData = GCM.Encrypt(dataToEncrypt, key, aad); byte[] decryptedData = GCM.Decrypt(encryptedData, decryptedAesKey, aad); Assert.IsTrue(dataToEncrypt.SequenceEqual(decryptedData)); string stringToEncrypt = "Ahoj svet"; byte[] encryptedStringData = GCM.Encrypt(Encoding.UTF8.GetBytes(stringToEncrypt), key, aad); byte[] decryptedStringData = GCM.Decrypt(encryptedStringData, decryptedAesKey, aad); Assert.AreEqual(stringToEncrypt, Encoding.UTF8.GetString(decryptedStringData)); }