This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using SuperWebSocket.Client; | |
using System; | |
public class Net : MonoBehaviour { | |
private string lastMessage = string.Empty; | |
public static string serverURI = "ws://192.168.100.196:12345/channels/0?userId=1"; | |
public static WebSocket webSocket = new WebSocket(serverURI, "basic"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class NaturalOrientation : MonoBehaviour { | |
public static int ORIENTATION_UNDEFINED = 0x00000000; | |
public static int ORIENTATION_PORTRAIT = 0x00000001; | |
public static int ORIENTATION_LANDSCAPE = 0x00000002; | |
public static int ROTATION_0 = 0x00000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class LinkObject { | |
public LinkObject prev = null; | |
public LinkObject next = null; | |
public GameObject data; | |
public LinkObject(GameObject link) { | |
data = link; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
meter{ | |
display: block; | |
border: 1px outset; | |
height: 20px; | |
width: 100px; | |
overflow: hidden; | |
} | |
meter div | |
{ | |
display: block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac | |
import simplejson as json | |
from base64 import urlsafe_b64decode | |
from hashlib import sha256 | |
def parse_signed_request(signed_request, secret): | |
[encoded_sig, payload] = signed_request.split('.') | |
# decode data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop this script in the Editor directory in your project (creating the Editor directory if it's not there yet) | |
// Then re-import the assets in the directories covered by this script (right click and reimport) | |
// | |
// I would replace my path checking with the path checking from this gist: | |
// https://gist.github.com/1842177 | |
// | |
// The texture settings for icons might want to use some of his settings combined with mine as well | |
using UnityEngine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import SocketServer | |
from base64 import b64encode | |
from hashlib import sha1 | |
from mimetools import Message | |
from StringIO import StringIO | |
# import threading | |
class WebSocketsHandler(SocketServer.StreamRequestHandler): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Mobile/Ambient Diffuse Detail" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_Detail ("Detail (RGB)", 2D) = "gray" {} | |
} | |
SubShader { | |
Pass{ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Converts Mobile Touch to the default Mouse Click | |
## invoked these method in Mobile too | |
OnMouseDown | |
OnMouseDrag | |
OnMouseUp | |
## only called in touch screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using UnityEngine; | |
using System; | |
using System.Collections; | |
using System.Text; | |
/* Based on the JSON parser from | |
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html | |
* | |
* I simplified it so that it doesn't throw exceptions | |
* and can be used in Unity iPhone with maximum code stripping. |