public static void Init(PhotonController controller) { _hotKeyManager = new HotKeyManager(); _hotKeyManager.KeyPressed += HotKeyManagerPressed; HotkeyCallbacks.InitInstance(controller); }
public static int HandleZoneExit(this PhotonController controller, EventData eventData) { int userId = (int)eventData[(byte)ParameterCode.UserId]; //GameManager.OnUserLeave(userId); return(userId); }
void Start() { photonView = gameObject.GetPhotonView(); enemyTransf = GetComponent <Transform>(); shootingCounter = 0f; target = FindClosestPlayer(); photonController = GameObject.FindGameObjectWithTag("PhotonController").GetComponent <PhotonController>(); }
public StrategyManager(PhotonController controller) { _strategies = new List <IStrategy>(); _strategies.Add(new BalancingStrategy(controller)); _strategies.Add(new HighAvailabilityStrategy(controller)); _strategies.Add(new StatisticsStrategy(controller)); // TODO: load DLL plugins }
public static void SendSaveTutorialStep(this PhotonController controller) { Dictionary <byte, object> parameters = new Dictionary <byte, object>(); parameters.Add((byte)ParameterCode.SubCode, SubCode.TutorStep); parameters.Add((byte)ParameterCode.TargetId, GameManager.GameUser.Base.TutorStep); controller.SendOperation((byte)OperationCode.UserUpdate, parameters); Debug.Log("SendSaveTutorialStep " + (int)GameManager.GameUser.Base.TutorStep); }
public StatisticsStrategy(PhotonController controller) { _controller = controller; var servers = controller.GetCurrentConfiguration().configs; var randomIndex = new Random().Next() % servers.Count; _currentServer = servers[randomIndex]; //choose a server randomly at first _timer = new Timer(ReloadStatisticsAndChooseAServer); }
public static void SendRequestAcceptBattle(this PhotonController controller, GameUser user) { Dictionary <byte, object> parameters = new Dictionary <byte, object>(); parameters.Add((byte)ParameterCode.SubCode, SubCode.Accept); parameters.Add((byte)ParameterCode.TargetId, user.Id); controller.SendOperation((byte)OperationCode.Battle, parameters); //Debug.Log("SendRequestAcceptBattle " + user.Id); }
public static void InitInstance(PhotonController controller) { if (Instance != null) { return; } Instance = new HotkeyCallbacks(controller); }
private static void RunGenerateShadowsocksUrlTest(IReadOnlyDictionary <string, Server> testCases) { foreach (var testCase in testCases) { string expected = testCase.Key; Server config = testCase.Value; var actual = PhotonController.GetServerURL(config); Assert.AreEqual(expected, actual); } }
private void Start() { photonView = gameObject.GetPhotonView(); photonController = GameObject.FindGameObjectWithTag("PhotonController").GetComponent <PhotonController>(); currentHealth = maxHealth; healthText = GameObject.FindGameObjectWithTag("HealthText").GetComponent <Text>(); UpdateHealth(0); otherDeadCanvas = GameObject.FindGameObjectWithTag("OtherDeadCanvas").transform.GetChild(0).gameObject; otherDeadCanvas.SetActive(false); playerMovementMultiplayer = this.GetComponent <PlayerMovementMultiplayer>(); }
PhotonController() { //save time instead of searching for the game controller //check if the instance is not null, we are creating more than one instance, warn us if (instance != null) { Debug.LogError("There's an instance already created, click on the next error to check it", gameObject); Debug.LogError("Original PhotonController instance is", instance.gameObject); return; } instance = this; }
private void Awake() { if (controller != null) { DestroyImmediate(gameObject); return; } DontDestroyOnLoad(gameObject); controller = this; PhotonNetwork.automaticallySyncScene = true; }
public static void HandleReponseGetFriendList(this PhotonController controller, OperationResponse response) { byte[] friends = (byte[])response[(byte)ParameterCode.Friends]; UserFriend[] userFriends = Serialization.LoadArray <UserFriend>(friends, true); if (userFriends == null) { return; } GameManager.GameUser.UserFriends.Clear(); GameManager.GameUser.UserFriends.AddRange(userFriends); }
public static void HandlePvPSearch(this PhotonController controller, EventData eventData) { //string userName = (string)eventData[(byte)ParameterCode.UserName]; if (UIPVPSearchManager.Instance != null) { return; } GameObject prefab = Resources.Load("Prefabs/UI/PVPSearch") as GameObject; GameObject.Instantiate(prefab); }
public static GameUser HandleZoneEnter(this PhotonController controller, EventData eventData) { int userId = (int)eventData[(byte)ParameterCode.UserId]; // string userInfo = (string)eventData[(byte)ParameterCode.UserInfo]; GameUser userMini = new GameUser() { Id = userId }; userMini.Tag = new GameUserClient(); //userMini.InitBase(userInfo); //GameManager.OnUserEnter(userMini); return(userMini); }
public ProxyForm(PhotonController controller) { this.Font = System.Drawing.SystemFonts.MessageBoxFont; InitializeComponent(); UpdateTexts(); this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); this.controller = controller; controller.ConfigChanged += controller_ConfigChanged; UpdateEnabled(); LoadCurrentConfiguration(); }
public ConfigForm(PhotonController controller) { this.Font = System.Drawing.SystemFonts.MessageBoxFont; InitializeComponent(); // a dirty hack this.ServersListBox.Dock = System.Windows.Forms.DockStyle.Fill; this.PerformLayout(); UpdateTexts(); this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); this.controller = controller; controller.ConfigChanged += controller_ConfigChanged; LoadCurrentConfiguration(); CpuID_verification(); }
public StatisticsStrategyConfigurationForm(PhotonController controller) { if (controller == null) { return; } InitializeComponent(); _speedSeries = StatisticsChart.Series["Speed"]; _packageLossSeries = StatisticsChart.Series["Package Loss"]; _pingSeries = StatisticsChart.Series["Ping"]; _controller = controller; _controller.ConfigChanged += (sender, args) => LoadConfiguration(); LoadConfiguration(); Load += (sender, args) => InitData(); }
public static void HandleReponseCheckMail(this PhotonController controller, OperationResponse response) { byte[] mails = (byte[])response[(byte)ParameterCode.UserMails]; if (mails == null) { return; } UserMail[] userMail = Serialization.LoadArray <UserMail>(mails, true); if (userMail == null) { return; } GameManager.GameUser.UserMails.Clear(); GameManager.GameUser.UserMails.AddRange(userMail); }
private void QRCodeForm_Load(object sender, EventArgs e) { var servers = Configuration.Load(); var serverDatas = servers.configs.Select( server => new KeyValuePair <string, string>(PhotonController.GetServerURL(server), server.FriendlyName()) ).ToList(); listBox1.DataSource = serverDatas; var selectIndex = serverDatas.FindIndex(serverData => serverData.Key.StartsWith(code)); if (selectIndex >= 0) { listBox1.SetSelected(selectIndex, true); } }
public MenuViewController(PhotonController controller) { this.controller = controller; LoadMenu(); controller.EnableStatusChanged += controller_EnableStatusChanged; controller.ConfigChanged += controller_ConfigChanged; controller.PACFileReadyToOpen += controller_FileReadyToOpen; controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen; controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged; controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged; controller.EnableGlobalChanged += controller_EnableGlobalChanged; controller.Errored += controller_Errored; controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted; controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError; _notifyIcon = new NotifyIcon(); UpdateTrayIcon(); _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu1; _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked; _notifyIcon.MouseClick += notifyIcon1_Click; _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick; _notifyIcon.BalloonTipClosed += _notifyIcon_BalloonTipClosed; controller.TrafficChanged += controller_TrafficChanged; this.updateChecker = new UpdateChecker(); updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted; LoadCurrentConfiguration(); Configuration config = controller.GetConfigurationCopy(); if (config.isDefault) { _isFirstRun = true; ShowConfigForm(); } else if (config.autoCheckUpdate) { _isStartupChecking = true; updateChecker.CheckUpdate(config, 3000); } }
public HotkeySettingsForm(PhotonController controller) { InitializeComponent(); UpdateTexts(); Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); _controller = controller; _controller.ConfigChanged += controller_ConfigChanged; LoadCurrentConfiguration(); // get all textboxes belong to this form _allTextBoxes = tableLayoutPanel1.GetChildControls <TextBox>(); if (!_allTextBoxes.Any()) { throw new Exception("Cannot get all textboxes"); } }
public LogForm(PhotonController controller, string filename) { this.controller = controller; this.filename = filename; InitializeComponent(); Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); LogViewerConfig config = controller.GetConfigurationCopy().logViewer; topMostTrigger = config.topMost; wrapTextTrigger = config.wrapText; toolbarTrigger = config.toolbarShown; LogMessageTextBox.BackColor = config.BackgroundColor; LogMessageTextBox.ForeColor = config.TextColor; LogMessageTextBox.Font = config.Font; controller.TrafficChanged += controller_TrafficChanged; UpdateTexts(); }
void Start() { _WebCamCon = GameObject.Find("WebCameraController").GetComponent <WebCameraController>(); if (_WebCamCon == null) { Debug.Log("Can't find WebCameraController."); return; } _UICon = GameObject.Find("UIController").GetComponent <UIController>(); if (_UICon == null) { Debug.Log("Can't find UIController."); return; } _PhCon = GameObject.Find("PhotonController").GetComponent <PhotonController>(); if (_PhCon == null) { Debug.Log("Can't find PhotonController."); return; } }
public static void HandleNotification(this PhotonController controller, EventData eventData) { string chatMsg = (string)eventData[(byte)ParameterCode.Message]; int idSender = (int)eventData[(byte)ParameterCode.UserId]; //SubCode subCode = (SubCode)eventData[(byte)ParameterCode.ev]; bool system = false; if (idSender == 0) { chatMsg = getFormatMessageSystem(chatMsg); if (chatMsg != "") { system = true; } } else { if (idSender == GameManager.GameUser.Id) { return; } } if (UINotificationManager.Instance == null) { GameObject prefab = Resources.Load("Prefabs/UI/UINotification") as GameObject; GameObject go = GameObject.Instantiate(prefab) as GameObject; UINotificationManager.Instance = go.GetComponent <UINotificationManager>(); } if (chatMsg != "") { UINotificationManager.Instance.AddText(chatMsg, system); } }
// Update is called once per frame void Update() { GameObject photon = ObjectPool.SharedInstance.GetPooledParticle("Photon"); GameObject atom = ObjectPool.SharedInstance.GetPooledParticle("Atom"); while (photon != null) { photon.SetActive(true); photon = ObjectPool.SharedInstance.GetPooledParticle("Photon"); } while (atom != null) { Pair spawn = RandomSpawnLocation(); atom.transform.position = new Vector2(PhotonController.xTransform(spawn.x), PhotonController.yTransform(spawn.y)); atom.SetActive(true); atom = ObjectPool.SharedInstance.GetPooledParticle("Atom"); } numberText.text = PlayerController.atomicNumber.ToString(); elementText.text = PlayerController.element; symbolText.text = PlayerController.symbol; massText.text = PlayerController.atomicMass; if (!player.gameObject.activeInHierarchy) { levelEnd.text = "Game Over"; playAgainButton.gameObject.SetActive(true); } else if (!ObjectPool.SharedInstance.HasParticleOfType("Atom")) { levelEnd.text = "You have outgrown your surroundings!"; continueButton.gameObject.SetActive(true); } }
public BalancingStrategy(PhotonController controller) { _controller = controller; _random = new Random(); }
private HotkeyCallbacks(PhotonController controller) { _controller = controller; }
void Start() { Controller = GameObject.Find("PhotonController").GetComponent <PhotonController>(); }
using UnityEngine; using UnityStandardAssets.Characters.FirstPerson; public class NetworkPlayerManager : Photon.MonoBehaviour { PhotonController photonController; public int life = 100; void Start() { if (photonView.isMine) { { GetComponent <Rigidbody>().useGravity = true; GetComponent <FirstPersonController>().enabled = true; GetComponentInChildren <ScoreManager>().enabled = true; GetComponentInChildren <FiringController>().enabled = true; GetComponentInChildren <Camera>().enabled = true; GetComponentInChildren <ParamScript>().enabled = true; GetComponentInChildren <Canvas>().enabled = true; photonController = (PhotonController)FindObjectOfType(typeof(PhotonController)); } } }