public void Timer_Callback(TimerCallback timer) { var gid = timer.GetFieldValue("gid"); var player = Server.Players[gid]; try { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.basePlayer.net.connection }, null, "DestroyUI", "testpanel7766"); } catch (ArgumentNullException) { } var commui = new PlutonUIEntity(player.basePlayer.net.connection); var testpanel7766 = commui.AddPanel( "TestPanel7766", "Overlay" ); testpanel7766.AddComponent(new Pluton.PlutonUI.RectTransform() { anchormin = "0 0", anchormax = "1 1" }); var nonamepanel = commui.AddPanel(null, "TestPanel7766"); nonamepanel.AddComponent(new Pluton.PlutonUI.RectTransform() { anchormin = "0 0.5", anchormax = "1 0.9" }); nonamepanel.AddComponent(new Pluton.PlutonUI.Text() { text = "Prefab Name", fontSize = 20, align = "TopCenter" }); Vector3 loc = player.GetLookPoint(); RaycastHit[] hit = Physics.RaycastAll(loc, Vector3.down); foreach (RaycastHit x in hit) { if (x.collider.gameObject.ToBaseEntity() != null) { nonamepanel.AddComponent(new Pluton.PlutonUI.Text() { text = x.collider.gameObject.ToBaseEntity().name, fontSize = 20, align = "MiddleCenter" }); } } commui.CreateUI(); }
public void Timer_Callback(TimerCallback timer) { var gid = timer.GetFieldValue("gid"); var player = Server.Players[gid]; try { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.basePlayer.net.connection }, null, "DestroyUI", "testpanel7766"); } catch(ArgumentNullException){ } var commui = new PlutonUIEntity(player.basePlayer.net.connection); var testpanel7766 = commui.AddPanel( "TestPanel7766", "Overlay" ); testpanel7766.AddComponent (new Pluton.PlutonUI.RectTransform(){ anchormin = "0 0", anchormax = "1 1" }); var nonamepanel = commui.AddPanel (null, "TestPanel7766"); nonamepanel.AddComponent (new Pluton.PlutonUI.RectTransform(){ anchormin = "0 0.5", anchormax = "1 0.9" }); nonamepanel.AddComponent (new Pluton.PlutonUI.Text(){ text = "Prefab Name", fontSize = 20, align = "TopCenter" }); Vector3 loc = player.GetLookPoint(); RaycastHit[] hit = Physics.RaycastAll(loc, Vector3.down); foreach (RaycastHit x in hit) { if (x.collider.gameObject.ToBaseEntity() != null) { nonamepanel.AddComponent (new Pluton.PlutonUI.Text () { text = x.collider.gameObject.ToBaseEntity().name, fontSize = 20, align = "MiddleCenter" }); } } commui.CreateUI(); }