Click or drag to resize

Send2DTexture_Example Class

Used to demonstrate how a Texture2D can be sent to other users. While the Texture being sent technically already exists, there is nothing preventing the texture to be sent from being dynamically created or modified and then sent. It was just easier to sent up this way than to create something dynamically.
Inheritance Hierarchy
SystemObject
  Object
    Component
      Behaviour
        MonoBehaviour
          SimpleDemosSend2DTexture_Example

Namespace:  SimpleDemos
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
public class Send2DTexture_Example : MonoBehaviour

The Send2DTexture_Example type exposes the following members.

Constructors
  NameDescription
Public methodSend2DTexture_Example
Initializes a new instance of the Send2DTexture_Example class
Top
Methods
  NameDescription
Public methodStatic memberChangeSpriteTexture
The function is called after the Texture2D is sent by all users. Note: All users must have this function defined for them (just like with other callback functions except claim). Just because other users do not have the Texture2D being sent does not mean they do not need this function. This function can be used to do whatever you want to do after the Texture2D has been transferred. In this case, it is simply swapping the Texture2D out on the current sprite, changing the image the sprite displays. This function can be named anything, but must be a static public void function.
Public methodSendAndChangeTexture
An example of how to send a Texture2D. Optional parameters include to send it as a PNG (larger file, but allows for transparent pixels, default is JPG), and to synchronize every user's callback function (in this case, "ChangeSPriteTexture"), the default is to not synchronize callback functions, so once a user downloads an image, by default they will execute their given function instead of waiting for every other user to download the image as well.
Private methodStart
Start function is used to set up the button listener
Top
Fields
  NameDescription
Public field_MyASLObject
A handle to the ASL object we will be using to send the texture and change the texture on
Private field_SendTextureButton
A handle to the button used to initiate the texture transfer
Public field_StartingTexture
The starting texture of our sprite
Public field_TextureToSend
The texture we will send to other users
Top
See Also