using UnityEngine;using System.Collections;public class Test : MonoBehaviour { public Texture2D t; public Color drawColor = new Color32(240, 190, 170, 255); public Color defaultColor = new Color32(0, 0, 0, 0); Color minValveColor = new Color32(245, 237, 210, 255); Color maxValveColor = new Color32(255, 248, 230, 255); float minR = 0; float minG = 0; float minB = 0; float maxR = 0; float maxG = 0; float maxB = 0; Texture2D tt; void Start () { minR = minValveColor.r ; minG = minValveColor.g ; minB = minValveColor.b ; maxR = maxValveColor.r ; maxG = maxValveColor.g ; maxB = maxValveColor.b ; transform.localScale = new Vector3 ((float)t.width/(float)t.height, 1); InvokeRepeating ("MyUpdate", 0, 1); } string z = ""; void MyUpdate () { if(tt != null){ Destroy(tt); } tt = new Texture2D (t.width, t.height); for(int y = 0; y < t.height; y++){ for(int x = 0; x < t.width; x++){ Color c = t.GetPixel(x, y); float r = c.r ; float g = c.g ; float b = c.b ; if(r >= minR && r <= maxR && g >= minG && g <= maxG && b >= minB && b <= maxB){ tt.SetPixel(x, y, drawColor); }else{ tt.SetPixel(x, y, defaultColor); } } } tt.Apply (); renderer.material.mainTexture = tt; }}黃彥霖 發表在 痞客邦 留言(0) 人氣(560)
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
黃彥霖 發表在 痞客邦 留言(2) 人氣(2,827)
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
黃彥霖 發表在 痞客邦 留言(0) 人氣(540)

using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
黃彥霖 發表在 痞客邦 留言(0) 人氣(632)
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
黃彥霖 發表在 痞客邦 留言(3) 人氣(1,051)

執行結果:
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
黃彥霖 發表在 痞客邦 留言(0) 人氣(1,286)
執行結果:My.css 檔案
.root {
-fx-background-image: url("Loli.jpg");
-fx-background-size: 675px 600px;
}
黃彥霖 發表在 痞客邦 留言(0) 人氣(499)
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
黃彥霖 發表在 痞客邦 留言(0) 人氣(468)
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
黃彥霖 發表在 痞客邦 留言(0) 人氣(1,149)