Skip to content

Instantly share code, notes, and snippets.

@sfszh
sfszh / WeiboShare.h
Last active December 20, 2015 17:39
simple demo sharing to sina weibo using ShareSDK and Untiy3D in iOS. we share a sentence and a captured image.
//
// WeiboShare.h
// Unity-iPhone
//
// Created by Sophos Zhang on 6/25/13.
//
//
#import <Foundation/Foundation.h>
#import <ShareSDK/ShareSDK.h>
@sfszh
sfszh / TabListener.cs
Created July 2, 2013 12:42
if listened tab number is active the gameobject was enabled other wise disabled, use with tabController https://gist.github.com/sfszh/5908899
using UnityEngine;
using System.Collections;
// this is a general tab listener
public class TabListener : MonoBehaviour {
public TabController tabController;
public int listenedTabNumber; // listenedTabNumber tabnumber
void TabHandler(int tabNumber) {
Debug.Log("number is " +tabNumber);
@sfszh
sfszh / TabController.cs
Last active December 19, 2015 06:08
a simple TabView controller in unity3D, require NGUI
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TabController : IgnoreTimeScale {
public List<UICheckbox> tabs;
public bool canStartUncalled = true;
public int StartedTabNumber = 0; // there should be one tab started as checked
public delegate void OnTabSelected(int tabNumber);
@sfszh
sfszh / UIToolExtension.cs
Last active December 17, 2015 12:29
make refresh the collider in NGUI widgets a little bit easier
using UnityEngine;
using UnityEditor;
using System.Collections;
static public class UIToolExtension{
//add this to NGUImenu.cs
[MenuItem("NGUI/Refresh a Collider #&r")]
static public void RefreshCollider() {
GameObject go = Selection.activeGameObject;
@sfszh
sfszh / test_shader_2.shader
Created December 12, 2012 10:24
second shader
Shader "Custom/testShader2" {
Properties {
_Color("Main Color",Color) = (1,1,1,1)
_SpecColor("Spec Color", Color) = (1,1,1,1)
_Emission("Emmisive Color", Color) = (0,0,0,0)
_Shininess("Shininess", Range(0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
//Tags { "RenderType"="Opaque" }
@sfszh
sfszh / test_shader_0.shader
Created December 12, 2012 10:23
First shader I made
Shader "Custom/NewShader" {
Properties {
_Color("Color",Color) = (1,0,0)
_MainTex("Texture Main", 2D) = ""{ TexGen sphereMap }
_AltTex("Texture Alt", 2D) = "" { }
_Number("nameNumber", Range(0,1)) = 1
}
SubShader {