void Start()
 {
     socket    = GetComponent <SocketIOComponent>();
     map       = FindObjectOfType <MapBuilder>();
     player    = FindObjectOfType <Player>();
     encounter = FindObjectOfType <Encounter>();
     info      = FindObjectOfType <PlayerInfoDisplay>();
     AddHandler("map", OnSocketMap);
     AddHandler("player", OnSocketPlayer);
     AddHandler("playerstatus", OnSocketPlayerStatus);
     AddHandler("encounter", OnSocketEncounter);
     AddHandler("leaderboard", OnSocketLeaderboard);
     if (player.playerId == 0)
     {
         SceneManager.LoadScene("Login");
     }
 }
Exemple #2
0
        public override void Attached()
        {
            _team           = Classes.Unassigned;
            _iPlayerInfo    = entity.GetState <IPlayerInfo>();
            _menuController = MenuController.GetInstance();

            MenuController.OnSwitchToStudentTeam    += SwitchToStudentTeam;
            MenuController.OnSwitchToTeacherTeam    += SwitchToTeacherTeam;
            MenuController.OnSwitchToUnassignedTeam += SwitchToUnassignedTeam;

            state.AddCallback("Username", UsernameChangeUpdate);
            state.AddCallback("Team", TeamChangeUpdate);
            state.AddCallback("Entity", EntityChangedUpdate);

            if (entity.IsOwner)
            {
                state.Team = Classes.Unassigned.ToString();
            }

            _playerInfoDisplay = Instantiate(_menuController.playerInfoDisplayPrefab, _menuController.unassignedTeam);
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the StashPanel class.  Hard coded to 4 stash buttons and no autosort buttons.
        /// </summary>
        /// <param name="dragInfo">ItemDragInfo instance</param>
        /// <param name="panelSize">Size of the panel in cells</param>
        /// <param name="tooltip">ToolTip instance</param>
        public StashPanel(ItemDragInfo dragInfo, Size panelSize) : base(dragInfo, 4, panelSize, 0, AutoMoveLocation.Stash)
        {
            this.equipmentPanel = new EquipmentPanel(16, 14, dragInfo, AutoMoveLocation.Stash);

            this.Controls.Add(this.equipmentPanel);
            this.equipmentPanel.OnNewItemHighlighted    += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback);
            this.equipmentPanel.OnAutoMoveItem          += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback);
            this.equipmentPanel.OnActivateSearch        += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback);
            this.equipmentPanel.OnItemSelected          += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback);
            this.equipmentPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback);
            this.equipmentPanel.OnResizeForm            += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback);
            this.equipmentPanel.MouseMove  += new MouseEventHandler(this.StashPanelMouseMove);
            this.equipmentPanel.MouseLeave += new EventHandler(this.StashPanelMouseLeave);
            this.equipmentPanel.MouseClick += new MouseEventHandler(this.StashPanelMouseClick);
            //this.MouseMove += new MouseEventHandler(this.StashPanelMouseMove);
            //this.MouseHover += new MouseEventHandler(this.StashPanelMouseMove);

            this.Text           = Resources.StashPanelText;
            this.NoPlayerString = Resources.StashPanelText;
            this.Size           = new Size(
                (panelSize.Width * UIService.UI.ItemUnitSize) + Convert.ToInt32(10.0F * UIService.UI.Scale) + BorderPad,
                (panelSize.Height * UIService.UI.ItemUnitSize) + Convert.ToInt32(60.0F * UIService.UI.Scale) + BorderPad);
            this.Paint += new PaintEventHandler(this.PaintCallback);

            this.BagSackPanel.SetLocation(new Point(BorderPad, this.Size.Height - (this.BagSackPanel.Size.Height + BorderPad)));
            this.BagSackPanel.MaxSacks = 1;
            this.BagSackPanel.Anchor   = AnchorStyles.None;

            //this.EquipmentBackground = Resources.Equipment_bg_new;
            this.background      = this.EquipmentBackground = Resources.equipment_bg_and_char;
            this.StashBackground = Resources.caravan_bg;

            // Set up the inital font size
            if (UIService.UI.Scale != 1.0F)
            {
                this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * UIService.UI.Scale, this.Font.Style);
            }

            //x and y coordinates passed are normalized values between 0 and 1.0.
            playerInfoDisplay = new PlayerInfoDisplay(Config.Settings.Default, this, this.Font, .83, .14);

            // Now that the buttons are set we can move the panel
            this.BagSackPanel.SetLocation(new Point(
                                              BorderPad,
                                              this.BagButtons[0].Location.Y + this.BagButtons[0].Size.Height + UIService.UI.HalfUnitSize));

            int offsetX = (panelSize.Width - this.equipmentPanel.SackSize.Width) * UIService.UI.HalfUnitSize;

            if (offsetX < 0)
            {
                offsetX = 0;
            }

            int offsetY = (panelSize.Height - this.equipmentPanel.SackSize.Height) * UIService.UI.HalfUnitSize;

            if (offsetY < 0)
            {
                offsetY = 0;
            }

            this.equipmentPanel.SetLocation(new Point(
                                                offsetX,
                                                this.BagButtons[0].Location.Y + this.BagButtons[0].Size.Height + offsetY));

            this.maxPanelSize = panelSize;

            this.BagSackPanel.Visible = false;
            this.BagSackPanel.Enabled = false;
        }
 public void SetInfo(PlayerInfoDisplay infoDisplay)
 {
     info = infoDisplay;
 }