Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - col000r

Pages: [1] 2 3
1
TNet 3 Support / Re: How to use the WorkerThread script
« on: August 17, 2016, 02:11:51 PM »
Fantastically useful stuff! Thanks for adding it!

It took me a little while to understand what WorkerThread.CreateConditional does. I though it meant that it does something on the thread, then depending on the return value, calls the second delegate - or not. Well, no.

Here is how it really works: The first delegate is called over and over and over until it returns false, then the second delegate is called.

  1. TNet.WorkerThread.CreateConditional(
  2.     delegate() {
  3.         return distance > 100f
  4.     }, delegate() {
  5.         Debug.Log( "Close enough!" );
  6.     }
  7. );

2
Thanks for the tip! Now I'm doing it like this an it works:

  1. if( !System.IO.File.Exists( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" ) ) return false;
  2. byte[] fileContent = System.IO.File.ReadAllBytes( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" );
  3. vesselNode = DataNode.Read( fileContent, DataNode.SaveType.Text );

3
TNet 3 Support / Trying to save and load DataNodes to Assets/Resources/
« on: August 02, 2016, 09:45:07 AM »
Hey, I'm trying to save some information from an Editor-script to a Resources folder and then load it back in at runtime, but I'm getting the following error:

  1. Unknown prefix: 85 at position 1
  2. UnityEngine.Debug:LogError(Object)
  3. TNet.Tools:LogError(String, String, Boolean) (at Assets/TNet/Common/TNTools.cs:1001)
  4. TNet.Serialization:ReadObject(BinaryReader, Object, Int32, Type, Boolean) (at Assets/TNet/Common/TNSerializer.cs:2724)
  5. TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Common/TNSerializer.cs:2360)
  6. TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Common/TNSerializer.cs:2351)
  7. TNet.DataNode:Read(Byte[], SaveType) (at Assets/TNet/Common/DataNode.cs:585)
  8. TNet.DataNode:Read(Byte[]) (at Assets/TNet/Common/DataNode.cs:540)
  9. TNet.DataNode:Read(String, Boolean) (at Assets/TNet/Common/DataNode.cs:509)

What I'm doing to save it in the Editorscript is this:
  1. vNode.Write( Application.dataPath + "/_INFO/Resources/" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + ".txt", TNet.DataNode.SaveType.Text );

and then I try to load it at runtime like this:
  1. if( !System.IO.File.Exists( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" ) ) return false;
  2. vesselNode = DataNode.Read( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" );

Why isn't this working? What am I doing wrong? The content of the DataNode is just some ints, Vector3s and strings, nothing special

4
TNet 3 Support / Re: Add DataNode to DataNode?
« on: June 17, 2016, 08:40:08 AM »
Thank you very much!

5
TNet 3 Support / Add DataNode to DataNode?
« on: June 15, 2016, 10:35:06 AM »
Is there a way to add DataNodes to other DataNodes as values?
If I use SetHierarchy to create the whole DataNode I can then iterate through the entire thing and get DataNodes for all my branches and iterate through those, BUT if I create individual DataNodes and then add those to the main DataNode (node.AddChild( "blah", otherNode ) this doesn't work. What am I doing wrong?

6
NGUI 3 Support / Error with s_GetSizeOfMainGameView.Invoke in 5.4.0b9
« on: March 11, 2016, 08:27:09 AM »
Getting this error in the latest beta (5.4.0b9):

  1. NullReferenceException: Object reference not set to an instance of an object
  2. NGUITools.get_screenSize () (at Assets/NGUI/Scripts/Internal/NGUITools.cs:1871)
  3. UIPanel.GetViewSize () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1871)
  4. UIPanel.UpdateTransformMatrix () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1068)
  5. UIPanel.UpdateSelf () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1265)
  6. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1228)

and that points me to:

  1. mGameSize = (Vector2)s_GetSizeOfMainGameView.Invoke(null, null);

I see you're using reflection there to call some unity code. Did they change or rename that function?
Can you fix this please?

7
NGUI 3 Support / NGUI Lags behind Vive Controller
« on: January 26, 2016, 06:06:22 AM »
Hi, I'm trying to put some GUI onto an HTC Vive Controller and for some reason it lags behind when I move the controller.
I also put a little sphere mesh on it and that moves with it perfectly.

Have a look: I took a video

How can I fix this?


8
ok, great! Just what I wanted to hear :)

9
If I send something with Target.AllSaved, will every single packet get saved and sent to someone who joins later, or will he only get the newest one?

10
TNet 3 Support / Losing Packets
« on: September 14, 2015, 07:25:13 AM »
Hi, it appears that I'm somehow losing packets. (For example: I switch from day to night and one of the connected machines stays in day mode)
Now I thought that this can't happen with TCP, isn't TCP guaranteeing that every packet arrives?  (unless of course there's no connection)

How is TNet handling this? What happens when a packet can't be delivered? Will it re-try? When will a client disconnect?

11
NGUI 3 Support / How to Trigger a MouseClick from Script
« on: May 05, 2015, 03:55:06 AM »
I'm trying to make the mouse click and I need this to work no matter where the cursor is. And I want it to run its course through NGUI's event system just like a real mouseclick (ideally with all the OnPress, etc. being called as well.  (Basically what I'm trying to do is using the y-axis of a 3DConnexion SpaceMouse as a click, so the client can press on the big nob to click)

How can I do this? Is there a simple way to hook into this?

Because if I want to send OnPress, OnClick and everything, then I have to duplicate the entire logic behind that.

12
NGUI 3 Support / Re: How to do a Virtual Mousecursor for a VR GUI?
« on: February 27, 2015, 04:11:35 AM »
I figured it out. Right when I was about to re-implement all the click/hover/drag-stuff, I figured: why not simply replace the 4 occurances of Input.mousePosition in UICamera. So I Replaced those with my VirtualCursor.mousePosition and it works like a charm!

13
NGUI 3 Support / How to do a Virtual Mousecursor for a VR GUI?
« on: February 26, 2015, 11:32:10 AM »
I'm trying to create a virtual mousecursor that lives on a flat plane inside my VR application and can interact with my GUI. (Think: Monitor inside the 3D world)
What's the best way to approach this? So far I have an invisible widget that defines the space that the screen-coordinates are mapped to and a sprite that moves around inside that space according to Input.mousePosition - works well, BUT:

How can I make the virtual cursor hover and drag and click in there while keeping the real mouse-cursor from interacting with my GUI?

14
NGUI 3 Support / Please make inheriting from NGUI classes easier!
« on: November 14, 2014, 02:35:50 AM »
Hi,

Would it be possible to mark as many methods as possible as protected virtual?

Every once in a while I need functionality that is just a little bit different from what one of the built-in scripts provides and so I'm trying to inherit from that class, but every time I do that I have to change something inside the original class too, which means I'll have to do those exact same changes every time I update NGUI from then on.

15
NGUI 3 Support / Re: Clamped UILabel with three dots at the end
« on: October 23, 2014, 06:50:41 AM »
Thanks! That would have worked as well. I ended up doing this:

  1. string txt = this.label.text;
  2. this.label.UpdateNGUIText();
  3. int calcOffset = NGUIText.CalculateOffsetToFit( txt );
  4. if( calcOffset > 0 ) {
  5.         this.label.text = txt.Substring( 0, txt.Length - Mathf.Clamp( calcOffset + 2, 0, txt.Length ) ) + "...";
  6. }

Pages: [1] 2 3