公告版位
需要找什麼嗎? 左邊分類或許可以幫助你...

目前分類:[遊戲設計] Unity (100)

瀏覽方式: 標題列表 簡短摘要
這是進階版,入板可以參考這裡 http://lolikitty.pixnet.net/blog/post/68347592

--------------------------------------------------------------------------------------

MyServer.java


import java.net.*;

public class MyServer {

黃彥霖 發表在 痞客邦 留言(2) 人氣()

System.Drawing 的 DLL 檔案可至以下目錄中找到 :
C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0


using UnityEngine;
using System.Collections;
using System.Drawing;
using System.Threading;
using System;

public class NewBehaviourScript2 : MonoBehaviour {

黃彥霖 發表在 痞客邦 留言(0) 人氣()

如果你會寫到分段下載檔案 (續傳),那麼一定會需要使用分段寫入檔案 (續寫)
寫入一次後,如果意外中斷,還可以從上次的地方開始寫入
不需要再重頭開始寫入
有效節省時間

using UnityEngine;
using System.Collections;
using System.IO;

public class NewBehaviourScript : MonoBehaviour {

    public Texture2D t; // 請在這裡從外部拖一張圖片進來

    void Start () {

黃彥霖 發表在 痞客邦 留言(0) 人氣()


Unity (64bit) - A.unity - New Unity Project - PC, Mac & Linux Standalone DX11  


// 請把此程式掛在 Canvas 上,然後拖一張 Sprite 圖片進來

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using System.Collections.Generic;

黃彥霖 發表在 痞客邦 留言(2) 人氣()

本文參考 雨松 MoMo 的文章,加以改良並加入更多監聽事件

原文:http://www.xuanyusong.com/archives/3325


Test.cs

// 請把此程式掛在 Canvas 上,然後拖一張 Sprite 圖片進來

using UnityEngine;
using UnityEngine.UI;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

方法一:
Unity (64bit) - A.unity - New Unity Project - PC, Mac & Linux Standalone DX11_2  
// 請把此程式掛在 Canvas 上,然後拖一張 Sprite 圖片進來

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System.Collections;

public class Test : MonoBehaviour {

    public Sprite img;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

  • 這是一篇加密文章,請輸入密碼
  • 密碼提示:萌
  • 請輸入密碼:

該程式碼是套用在 Image(舉例) 物件上,如下圖所示:

Unity (64bit) - Test.unity - New Unity Project 22 - PC, Mac & Linux Standalone DX11  

RectTransform rt = GetComponent<RectTransform> ();

rt.anchoredPosition3D = new Vector3 (0, 0, 0); // 設定 座標 Pos X, Pos Y, Pos Z
rt.sizeDelta = new Vector2 (t.width, t.height); // 設定 寬, 高 Width, Height
rt.localEulerAngles = new Vector3 (0, 0, 45); // 設定 旋轉 Rotation
rt.localScale = new Vector3 (0.5f, 0.5f, 0.5f); // 設定 大小 Scale

黃彥霖 發表在 痞客邦 留言(0) 人氣()

該程式碼是套用在 Image 物件上,如下圖所示:

Unity (64bit) - Test.unity - New Unity Project 22 - PC, Mac & Linux Standalone DX11  

程式碼:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Test : MonoBehaviour {

    public Texture2D myImg; // 從外部拖拉自己喜歡的圖片進來

黃彥霖 發表在 痞客邦 留言(0) 人氣()

Unity (64bit) - Test.unity - New Unity Project 55 - PC, Mac & Linux Standalone DX11_2

Unity (64bit) - Test.unity - New Unity Project 55 - PC, Mac & Linux Standalone DX11  

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

public UITexture canvas;

public int canvasWidth = 800, canvasHeight = 600;
public Color canvasColor;

黃彥霖 發表在 痞客邦 留言(1) 人氣()

Unity (64bit) - Test3.unity - New Unity Project 55 - PC, Mac & Linux Standalone DX11  


// 回傳 Color32 版本

using UnityEngine;
using System.Collections;

public class Test3 : MonoBehaviour {

[Range(-3.14f, 3.14f)]
public float rotate = 0;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

基本版:

CPU   

using UnityEngine;
using System.Collections;
using System.Text.RegularExpressions;
using System;
using System.Text;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

RAM    


using UnityEngine;
using System.Collections;

public class RamTest : MonoBehaviour {

    void Start () {
        InvokeRepeating ("Refresh", 0, 1);
    }

黃彥霖 發表在 痞客邦 留言(0) 人氣()

工具列會出現 Loli/Moe 選項,點下去會列印 Moe

執行結果:

Unity - A.unity - New Unity Project 48 - PC, Mac & Linux Standalone DX11

Unity - A.unity - New Unity Project 48 - PC, Mac & Linux Standalone DX11_2  

// 方法一定要宣告成 static 才行

using UnityEngine;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

PrtScr capture  

Java Server (會使用 org.json):

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

到 UICamera.cs 中尋找 Awake() 函式方法,並把 useKeyboard 改為 true

可按造自己需求做修改:

useTouch = true;
useMouse = true;
useKeyboard = true;
useController = true;


 

黃彥霖 發表在 痞客邦 留言(0) 人氣()

//--------------------------------------------------- Test.cs 

using UnityEngine;
using System.Collections;
using System.IO;
using System.Threading;

public class Test : MonoBehaviour {

HttpDownloadFile f = new HttpDownloadFile ();

    void Start () {
        new Thread (Download).Start (); // 建立一條執行緒

黃彥霖 發表在 痞客邦 留言(0) 人氣()

// 把這個腳本套用在攝影機中,沒意外左上角會出現攝影機照出來的貼圖

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

    void OnGUI(){
        Texture2D texture = new Texture2D (Screen.width, Screen.height, TextureFormat.RGB24, false);
        texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        texture.Apply(false, false);

黃彥霖 發表在 痞客邦 留言(1) 人氣()

// Unity 程式碼:

using UnityEngine;
using System.Collections;
using System.IO.Ports;
using System.Threading;

public class Test : MonoBehaviour {

    void Start () {
        new Thread (Open).Start();
    }

黃彥霖 發表在 痞客邦 留言(1) 人氣()


using UnityEngine
using System.Collections
public class Test : MonoBehaviour { 

    void Start () { 
        string objPath = "file:///Users/Loli/Desktop/untitled.obj";
        string imgPath = "file:///Users/Loli/Desktop/untitled.png";
        ObjReaderInSence obj = new ObjReaderInSence();
        StartCoroutine(obj.SomeFunction(objPathimgPath));

黃彥霖 發表在 痞客邦 留言(0) 人氣()

1 2345