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 - appsdev

Pages: [1]
1
TNet 3 Support / Re: Packet.RequestLoadFile for loading save data
« on: November 24, 2014, 12:07:57 PM »
referenced to this: http://www.tasharen.com/tnet/docs/class_t_n_manager.html#a242088944ea89b4c1355ce8a36230c4a

Two classes, one for save and one to load. Saving is fine, I got the file and the string to save on the server.

Loading has an issue, the loading seems to always been taken from local not from the server. I set the filename to one that had been deleted on the server. When I load it reads data from a local file as the one from the server had been deleted. I don't know where this local file reside.

According to the class reference it should read from the server. May I know what I might be missing from the script? And where might this file be located locally?

My code:
  1. public class SaveGame : MonoBehaviour {
  2.  
  3.         public void SaveAGame()
  4.         {
  5.                 BinaryWriter writer = TNManager.BeginSend(Packet.RequestSaveFile);
  6.                 writer.Write("testfile3");
  7.                 writer.Write(50);
  8.                 writer.Write("77777777");
  9.  
  10.                 TNManager.EndSend();
  11.         }
  12. }
  13.  

  1. public class LoadGame : MonoBehaviour {
  2.        
  3.         static void OnLoadFile (string filename, byte[] data)
  4.         {
  5.                 // 'data' is your file's contents
  6.                 string result = System.Text.Encoding.UTF8.GetString(data);
  7.                 Debug.Log("file content: " + result.ToString());
  8.         }
  9.        
  10.         public void LoadFile (string filename)
  11.         {
  12.        
  13.                 TNManager.LoadFile(filename, OnLoadFile);
  14.         }
  15.  
  16. }
  17.  


2
TNet 3 Support / Packet.RequestLoadFile for loading save data
« on: October 23, 2014, 05:07:39 AM »
The problem I'm having is when I try to read the file it only reads the filename. What is necessary to read the contents of the file.

I have trying using the Binarywritter to first write the file locallly but I can't seem to make it as I'm getting the data from Packet.RequestLoadFile
Not for example "BinaryReader b = new BinaryReader(File.Open("some file name", FileMode.Open)). How do I make it so the file can get saved locally first? or there is another way to read the Packet.RequestLoadFile?

The following code came from another thread http://www.tasharen.com/forum/index.php?topic=9165.0
I have added the code for function OnLoadFile().  I try using the different kinds of 'reads' (char, chars...) but is only reads the filename not the contents from the file.

I think I'm getting close to the solution please help.
  1.  
  2. public class LoadGame : MonoBehaviour {
  3.  
  4.  
  5.         void Start()
  6.         {
  7.                 TNManager.SetPacketHandler(Packet.ResponseLoadFile, OnLoadFile);
  8.        
  9.         }
  10.        
  11.         void OnLoadFile (Packet response, BinaryReader reader, IPEndPoint source)
  12.         {
  13.        
  14.  
  15.        
  16.                 using (BinaryReader b = reader)
  17.                 {
  18.  
  19.  
  20.  
  21.                         // Position and length variables.
  22.                         int pos = 0;
  23.  
  24.                         // Use BaseStream.
  25.                         int length = (int)b.BaseStream.Length;
  26.                         while (pos < length)
  27.                         {
  28.  
  29.                                 // Read...
  30.                                 string v = b.ReadString();
  31.                                 Debug.Log(v.ToString());
  32.                                
  33.  
  34.                                 // Advance our position variable.
  35.                                 pos += sizeof(int);
  36.                         }
  37.                 }
  38.        
  39.  
  40.         }
  41.        
  42.         public void LoadFile (string filename)
  43.         {
  44.  
  45.        
  46.                 BinaryWriter writer = TNManager.BeginSend(Packet.RequestLoadFile);
  47.                 writer.Write(filename);
  48.                 TNManager.EndSend();
  49.        
  50.  
  51.         }
  52.        
  53. }
  54.  

3
Resolved by setting widget pivot.

4
The Typewriter effect in example 3 is aligned top left.
The first sentence starts at the top and each letter moves to the right. The alignment in the sample is set to automatic by default.

I'm testing with a label with typewriter effect either align left or automatic, the first sentence start center left, when a sentence reaches the end of line it will move up. 

How to adjust it so the effect is the same as example 3? That is, it aligns top left and the already typed sentence does not get pushed up.

5
OK I got it updated again it works now.

In direct its only showing the internal IP for both internal and external. Is this my local setting issue ?

6
I got it from the project manager.  It's latest version as I was told. May I know how I can check whether its really latest from looking at the files?

It seems that the problem arise when I click on the "TNET Integration" it will overwrite a bunch of files"

If I dont use the TNET Integration,  UICaptionCaps.cs
this line of code is like this "mCheck.value = (Localization.language == "Caps");"

if I run TNET Integration.
That line of codes changes to this "mCheck.value = (Localization.instance.currentLanguage == "Caps");"
This is the error showing.

7
Loaded the game scene.

found the following:
Assets/StarlinkUI/Scripts/Custom/UI/UIOptionWifi.cs(19,24): error CS1061: Type `UIToggle' does not contain a definition for `onStateChange' and no extension method `onStateChange' of type `UIToggle' could be found (are you missing a using directive or an assembly reference?)

8
I'm not sure if its ok to do this but I'm trying to make it run. so I made the following changes.

in UIOptionCaps.cs

   //mCheck.value = (Localization.instance.currentLanguage == "Caps");
      mCheck.value = (Localization.language == "Caps");

//Localization.instance.currentLanguage = UIToggle.current.value ? "Caps" : "English";
      Localization.language = UIToggle.current.value ? "Caps" : "English";

These errors show after the above changes.

Assets/StarlinkUI/Scripts/Generic/UI/UIWindow.cs(107,49): error CS1061: Type `UIPanel' does not contain a definition for `SetAlphaRecursive' and no extension method `SetAlphaRecursive' of type `UIPanel' could be found (are you missing a using directive or an assembly reference?)

9
After making the changes mentioned, I get this error.

Assets/StarlinkUI/Scripts/Custom/UI/UIOptionCaps.cs(30,30): error CS0117: `Localization' does not contain a definition for `instance'

Please advise.

10
I have imported NGUI.

I get this error. Please advise on what's the best way to resolve this?

Assets/StarlinkUI/Scripts/Generic/UI/UIChat.cs(159,50): error CS1061: Type `UIFont' does not contain a definition for `premultipliedAlpha' and no extension method `premultipliedAlpha' of type `UIFont' could be found (are you missing a using directive or an assembly reference?)

Pages: [1]