Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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;
                }
            }
        }
Exemplo n.º 3
0
    /// <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)
                );
        }
Exemplo n.º 5
0
        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GCM         = null;
            GCMFilePath = null;

            treeView1.Nodes.Clear();
        }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
 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");
 }
Exemplo n.º 8
0
        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" });
    }
Exemplo n.º 10
0
        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();
        }
Exemplo n.º 11
0
        public Log(GCM gcm)
        {
            this.gcm = gcm;

            SetSettings(GameSettingsLoader.LoadSettingsFromFile());

            Add(this);
        }
Exemplo n.º 12
0
        public GCMNode(GCM GCM, string FileName)
        {
            this.GCM = GCM;

            Text = Path.GetFileName(FileName);

            ImageIndex         = 0;
            SelectedImageIndex = 0;
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
    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);
    }
Exemplo n.º 15
0
    /// <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);
        }
Exemplo n.º 17
0
 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);
        }
Exemplo n.º 19
0
        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;
            }
        }
Exemplo n.º 21
0
        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;
        }
Exemplo n.º 22
0
        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);
            }
        }
Exemplo n.º 23
0
        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);
        }
Exemplo n.º 24
0
        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)
                );
        }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
0
        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));
        }
Exemplo n.º 27
0
        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();
        }
Exemplo n.º 28
0
    // 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;
        });
    }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        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));
        }