Exemplo n.º 1
0
        public void Update()
        {
            if (Input.GetKeyDown(KeyCode.P) && Input.GetKey(KeyCode.Tab))
            {
                MessageBox.Info($"PlayerPrefs:\n"
                                + $"{StrPrefs.input_message.ToString()} {PlayerPrefsWrapper.Get(StrPrefs.input_message)}\n"
                                + $"{StrPrefs.input_nickname.ToString()} {PlayerPrefsWrapper.Get(StrPrefs.input_nickname)}\n"
                                + $"{StrPrefs.server_ip.ToString()} {PlayerPrefsWrapper.Get(StrPrefs.server_ip)}\n"
                                + $"{StrPrefs.input_session_name.ToString()} {PlayerPrefsWrapper.Get(StrPrefs.input_session_name)}\n"
                                + $"{IntPrefs.chat_buffer_updates.ToString()} {PlayerPrefsWrapper.Get(IntPrefs.chat_buffer_updates)}\n"
                                + $"{IntPrefs.sender.ToString()} {PlayerPrefsWrapper.Get(IntPrefs.sender)}\n"
                                + $"{IntPrefs.session_id.ToString()} {PlayerPrefsWrapper.Get(IntPrefs.session_id)}\n");
            }

            if (Input.GetKeyDown(KeyCode.F12) && Input.GetKey(KeyCode.F2))
            {
                PlayerPrefs.DeleteAll();
            }

            if (Input.GetKeyDown(KeyCode.U) && Input.GetKey(KeyCode.Tab))
            {
                God.NetworkManager.Send(new in_game_info());
            }

            if (Input.GetKeyDown(KeyCode.L) && Input.GetKey(KeyCode.Tab))
            {
                PlayerPrefsWrapper.Set(StrPrefs.server_ip, Constants.IpLocalhost);
                God.NetworkManager.ConnectToServer();
            }
        }
 public override void Execute()
 {
     if (PlayerPrefsWrapper.Get(IntPrefs.chat_buffer_updates) != chat_buffer_updates)
     {
         PlayerPrefsWrapper.Set(IntPrefs.chat_buffer_updates, chat_buffer_updates);
         God.NetworkManager.Send(new in_read_chat());
     }
 }
Exemplo n.º 3
0
 private void Start()
 {
     if (PlayerPrefsWrapper.Get(KeyShouldExist) != 0)
     {
         UnityWrapper.GetRequestMethod(Request).Invoke();
         PlayerPrefsWrapper.Take(KeyShouldExist);
     }
     ;
 }
        public in_game_load()
        {
            string data = PlayerPrefsWrapper.Get(StrPrefs.data_save);

            if (!data.IsNullOrEmpty())
            {
                game = (abstract_game)JsonManager.Deserialize(data);
            }
        }
        public override void HandleSignal()
        {
            God.NetworkManager.Users = users;
            int uid = users.FindIndex(s => s == PlayerPrefsWrapper.Get(StrPrefs.input_nickname));

            if (uid == -1)
            {
                MessageBox.Error("You aren't registered. Contact administrator for additional info");
                return;
            }
            PlayerPrefsWrapper.Set(IntPrefs.sender, uid);
        }
        public abstract_generator generator; // : abstract_generator

        public in_game_setup(GeneratorType generatorType = GeneratorType.simple)
        {
            int        seed          = PlayerPrefsWrapper.Get(IntPrefs.setup_seed);
            List <int> playersUid    = SessionBehaviour.GetPlayers();
            int        tilemapScaleX = PlayerPrefsWrapper.Get(IntPrefs.setup_tilemap_scale_x);
            int        tilemapScaleY = PlayerPrefsWrapper.Get(IntPrefs.setup_tilemap_scale_y);

            switch (generatorType)
            {
            case GeneratorType.simple:
                generator = new simple(seed, playersUid, tilemapScaleX, tilemapScaleY);
                break;

            case GeneratorType.perlin:
                int   octaves     = PlayerPrefsWrapper.Get(IntPrefs.setup_octaves);
                float persistance = PlayerPrefsWrapper.Get(IntPrefs.setup_persistance) / 100f;
                generator = new perlin(seed, octaves, persistance, playersUid, tilemapScaleX, tilemapScaleY);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(generatorType), generatorType, null);
            }
        }
Exemplo n.º 7
0
        public void ConnectToServer()
        {
            if (IsConnected())
            {
                return;
            }
            string ip = PlayerPrefsWrapper.Get(StrPrefs.server_ip);

            try
            {
                Ws = new WebSocket($"wss://{ip}");
            }
            catch (Exception e)
            {
                MessageBox.Error($"WebSocketFactory exception: {e.Message}");
                return;
            }
            Ws.OnOpen    += WsOnOpen;
            Ws.OnMessage += WsOnMessage;
            Ws.OnError   += WsOnError;
            Ws.OnClose   += WsOnClose;
            Task.Run(() => Ws.Connect());
        }
 private void Start()
 {
     _button.interactable = PlayerPrefsWrapper.Get(KeyShouldExist) != "";
 }
Exemplo n.º 9
0
 private void Start()
 {
     _inputField.text = int.TryParse(_inputField.text, out int result) ? PlayerPrefsWrapper.Get(Key, result).ToString() : PlayerPrefsWrapper.Get(Key).ToString();
     PlayerPrefsWrapper.Set(Key, int.Parse(_inputField.text));
 }
Exemplo n.º 10
0
 public in_signal()
 {
     version = Constants.Version;
     sender  = PlayerPrefsWrapper.Get(IntPrefs.sender);
 }
Exemplo n.º 11
0
 public in_connect()
 {
     version  = Constants.Version;
     nickname = PlayerPrefsWrapper.Get(StrPrefs.input_nickname);
 }
Exemplo n.º 12
0
 public in_signal_session()
 {
     session_id = PlayerPrefsWrapper.Get(IntPrefs.session_id);
 }
Exemplo n.º 13
0
 private void Start()
 {
     _text.text = PlayerPrefsWrapper.Get(Key, _text.text);
 }
Exemplo n.º 14
0
 private void Start()
 {
     _inputField.text = PlayerPrefsWrapper.Get(Key, _inputField.text);
     PlayerPrefsWrapper.Set(Key, _inputField.text);
 }