Commit 6f2a7aa4 authored by 神楽坂玲奈's avatar 神楽坂玲奈

code reformat

parent 5771b093
using UnityEngine;
using System.Collections;
public class ContinuesButton : MonoBehaviour {
UIButton btn;
// Use this for initialization
void Start ()
public class ContinuesButton : MonoBehaviour
{
private UIButton btn;
private bool isTrigging;
// Update is called once per frame
private float time;
// Use this for initialization
private void Start()
{
btn = GetComponentInChildren<UIButton>();
UIEventTrigger trigger= gameObject.GetComponentInChildren<UIEventTrigger>();
if (trigger==null)
{
trigger = gameObject.AddComponent<UIEventTrigger>();
}
var trigger = gameObject.GetComponentInChildren<UIEventTrigger>();
if (trigger == null) trigger = gameObject.AddComponent<UIEventTrigger>();
trigger.onRelease.Add(new EventDelegate(this, "off"));
trigger.onPress.Add(new EventDelegate(this, "on"));
}
void on()
{
isTrigging = true;
time = 0;
}
void off()
private void Update()
{
isTrigging = false;
time = 0;
}
bool isTrigging = false;
// Update is called once per frame
float time = 0;
void Update () {
if (isTrigging)
{
if (btn!=null)
if (isTrigging)
if (btn != null)
{
time += Time.deltaTime;
if (time > 0.2f)
......@@ -43,6 +31,17 @@ public class ContinuesButton : MonoBehaviour {
EventDelegate.Execute(btn.onClick);
}
}
}
}
}
private void on()
{
isTrigging = true;
time = 0;
}
private void off()
{
isTrigging = false;
time = 0;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class MONO_wait : MonoBehaviour {
public class MONO_wait : MonoBehaviour
{
public UILabel lab;
string s = "";
// Use this for initialization
void Start ()
private float a;
private string s = "";
// Use this for initialization
private void Start()
{
s = InterString.Get("等待对方行动中");
}
float a = 0;
// Update is called once per frame
void Update () {
}
// Update is called once per frame
private void Update()
{
a += Time.deltaTime;
string t = "";
for (int i = 0; i < (((int)(a * 60)) / 20) % 4; i++)
{
t += InterString.Get("…");
}
var t = "";
for (var i = 0; i < (int) (a * 60) / 20 % 4; i++) t += InterString.Get("…");
lab.text = t + s + t;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class lazyBTNMOVER : MonoBehaviour {
public class lazyBTNMOVER : MonoBehaviour
{
public UILabel g1;
public UILabel g2;
public UILabel g3;
......@@ -47,4 +46,4 @@ public class lazyBTNMOVER : MonoBehaviour {
g5.text = "MP2";
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
public class phaser : MonoBehaviour {
public Action mp2Action;
public Action bpAction;
public Action epAction;
using System;
using UnityEngine;
public class phaser : MonoBehaviour
{
public BoxCollider colliderMp2;
public BoxCollider colliderBp;
public BoxCollider colliderEp;
public UILabel labDp;
public UILabel labSp;
public UILabel labMp1;
public UILabel labMp1;
public UILabel labBp;
public UILabel labMp2;
public UILabel labEp;
public UILabel labEp;
public Action bpAction;
public Action epAction;
public Action mp2Action;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
private void Start()
{
}
// Update is called once per frame
private void Update()
{
if (Program.InputGetMouseButtonUp_0)
{
if (Program.pointedCollider== colliderMp2)
{
if (mp2Action!=null)
{
if (Program.pointedCollider == colliderMp2)
if (mp2Action != null)
mp2Action();
}
}
if (Program.pointedCollider == colliderBp)
{
if (bpAction != null)
{
bpAction();
}
}
if (Program.pointedCollider == colliderEp)
{
if (epAction != null)
{
epAction();
}
}
}
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class pngSord : MonoBehaviour {
// Use this for initialization
void Start () {
public class pngSord : MonoBehaviour
{
// Use this for initialization
private void Start()
{
gameObject.GetComponent<Renderer>().material.mainTexture = GameTextureManager.attack;
gameObject.transform.localScale = new Vector3(1, 1f / (float)GameTextureManager.attack.width * (float)GameTextureManager.attack.height, 1);
gameObject.transform.localScale =
new Vector3(1, 1f / GameTextureManager.attack.width * GameTextureManager.attack.height, 1);
}
// Update is called once per frame
void Update () {
}
}
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System;
using UnityEngine;
using YGOSharp;
public class OpenCardOnClick : MonoBehaviour
{
void OnClick()
private void OnClick()
{
UILabel lbl = GetComponent<UILabel>();
var lbl = GetComponent<UILabel>();
if (lbl != null)
{
try
{
string s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition);
if (string.IsNullOrEmpty(s))
{
return;
}
int code = int.Parse(s);
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
var s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition);
if (string.IsNullOrEmpty(s)) return;
var code = int.Parse(s);
Program.I().cardDescription.setData(CardsManager.Get(code), GameTextureManager.myBack, "", true);
}
catch (System.Exception e)
catch (Exception e)
{
Debug.Log(e);
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class smartSelection : MonoBehaviour {
public class smartSelection : MonoBehaviour
{
public UILabel name_lable;
public UITexture under_;
......@@ -10,24 +10,24 @@ public class smartSelection : MonoBehaviour {
public GameObject obj;
public void setName(string s)
public void setName(string s)
{
name_lable.text = s;
}
public void setSelected(bool s)
public void setSelected(bool s)
{
under_.color = s ? Color.white : (new Color(0, 0, 0, 0));
under_.color = s ? Color.white : new Color(0, 0, 0, 0);
}
public string getNmae()
public string getNmae()
{
return name_lable.text;
}
public void set_width(int width)
public void set_width(int width)
{
int w = width + 80;
var w = width + 80;
under_.width = w;
collider.size = new Vector3(w, under_.height + 5, 1);
collider.center = new Vector3(0, -2.5f, 0);
......@@ -36,10 +36,7 @@ public class smartSelection : MonoBehaviour {
public static void IselectedSetter(GameObject obj, bool selected)
{
smartSelection smartSelection = obj.GetComponent<smartSelection>();
if (smartSelection != null)
{
smartSelection.setSelected(selected);
}
var smartSelection = obj.GetComponent<smartSelection>();
if (smartSelection != null) smartSelection.setSelected(selected);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class LAZYsetting : MonoBehaviour {
public class LAZYsetting : MonoBehaviour
{
public UISlider sliderVolum;
public UISlider sliderSizeDrawing;
public UISlider sliderSize;
......@@ -12,7 +12,7 @@ public class LAZYsetting : MonoBehaviour {
public UIToggle closeUp;
public UIToggle showoff;
public UIToggle showoffWhenActived;
public UIToggle cloud;
public UIToggle cloud;
public UIToggle Vbattle;
public UIToggle Vmove;
public UIToggle Vchain;
......@@ -42,12 +42,12 @@ public class LAZYsetting : MonoBehaviour {
public UIToggle spyer;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class YGO1superShower : MonoBehaviour {
public class YGO1superShower : MonoBehaviour
{
public UITexture card;
public UITexture closeup;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class pro1CardShower : MonoBehaviour {
public class pro1CardShower : MonoBehaviour
{
public UITexture card;
public UITexture mask;
public UITexture disable;
......@@ -19,4 +19,4 @@ public class pro1CardShower : MonoBehaviour {
t.duration = 0.7f;
t.enabled = true;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class rotatotr : MonoBehaviour {
// Use this for initialization
void Start () {
}
public class rotatotr : MonoBehaviour
{
// Use this for initialization
private void Start()
{
}
// Update is called once per frame
void Update()
private void Update()
{
transform.Rotate(Vector3.forward * Time.deltaTime * 80);
}
}
}
\ No newline at end of file

using UnityEngine;
using System.Collections;
using UnityEngine;
public class AnimUnit : MonoBehaviour
{
public float m_fspeed = 1;
private MegaWorldPathDeform m_kMWPD = null;
private MegaShapeArc m_kShapeArc = null;
private float m_fAccumAnimOffset = 0.0f;
private float m_fArrowHeadLenth = 0.57f;
//private float m_fRGB = 1/255.0f;
private float m_fHigh = 1.0f; //画线高度定值 --CardGame
void Start()
{
m_kMWPD = GetComponent<MegaWorldPathDeform> ();
m_fAccumAnimOffset = m_kMWPD.Offset.z;
//Debug.Log ("offset val is " + m_kAccumAnimOffset + " when init");
// this.gameObject.renderer.material =
// new Material(Shader.Find("Custom/CardSeriesShader"));
// this.gameObject.renderer.material.mainTexture=(Texture)Resources.Load("Texture/arrow");
//Color color = new Color(141* m_fRGB, m_fRGB, m_fRGB);
//this.gameObject.renderer.material.SetColor("_BlendColor",color);
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
}
void Update()
{
public float m_fspeed = 1;
private float m_fAccumAnimOffset;
private readonly float m_fArrowHeadLenth = 0.57f;
//private float m_fRGB = 1/255.0f;
private readonly float m_fHigh = 1.0f; //画线高度定值 --CardGame
private MegaWorldPathDeform m_kMWPD;
private MegaShapeArc m_kShapeArc;
private void Start()
{
m_kMWPD = GetComponent<MegaWorldPathDeform>();
m_fAccumAnimOffset = m_kMWPD.Offset.z;
//Debug.Log ("offset val is " + m_kAccumAnimOffset + " when init");
// this.gameObject.renderer.material =
// new Material(Shader.Find("Custom/CardSeriesShader"));
// this.gameObject.renderer.material.mainTexture=(Texture)Resources.Load("Texture/arrow");
//Color color = new Color(141* m_fRGB, m_fRGB, m_fRGB);
//this.gameObject.renderer.material.SetColor("_BlendColor",color);
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
private void Update()
{
// float fnowoffset = m_kShapeArc.GetCurveLength (0) - m_fAccumAnimOffset;
//
// float linelenth = (m_kShapeArc.GetCurveLength (0) - (m_fArrowHeadLenth*0.04f)/2 + 0.764f)/5;
......@@ -53,37 +51,23 @@ public class AnimUnit : MonoBehaviour
// {
// this.gameObject.renderer.material.SetFloat("_Alpha",0);
// }
}
// void AlphaSet()
// {
// m_kShapeArc.GetCurveLength (0);
// }
}
public void SetAllAlphaZero()
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
}
private void FixedUpdate()
{
if (m_kShapeArc == null) return;
void FixedUpdate()
{
if (m_kShapeArc == null)
{
return;
}
m_fAccumAnimOffset += -m_fspeed * Time.deltaTime;
//if (m_fAccumAnimOffset >= m_kShapeArc.GetCurveLength (0)-(m_fArrowHeadLenth*0.02f)/2 - 0.382f)
if (m_fAccumAnimOffset <= m_fArrowHeadLenth * 0.04f / 2 + 0.764f)
{
//m_fAccumAnimOffset = 0.0f;
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
m_kShapeArc.GetComponent<LoopPathAnim>().moveToTail(m_kMWPD);
}
m_fAccumAnimOffset += -m_fspeed * Time.deltaTime;
//if (m_fAccumAnimOffset >= m_kShapeArc.GetCurveLength (0)-(m_fArrowHeadLenth*0.02f)/2 - 0.382f)
if (m_fAccumAnimOffset <= (m_fArrowHeadLenth*0.04f)/2 + 0.764f)
{
//m_fAccumAnimOffset = 0.0f;
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
m_kShapeArc.GetComponent<LoopPathAnim>().moveToTail(m_kMWPD);
}
m_kMWPD.Offset.z = m_fAccumAnimOffset;
m_kMWPD.Offset.z = m_fAccumAnimOffset;
// float linelenth = (m_kShapeArc.GetCurveLength (0) - (m_fArrowHeadLenth*0.04f)/2 + 0.764f)/5;
// float lineMax = m_kShapeArc.GetCurveLength (0);
......@@ -105,38 +89,37 @@ public class AnimUnit : MonoBehaviour
// }
float fnowoffset = m_kShapeArc.GetCurveLength (0) - m_fAccumAnimOffset;
var fnowoffset = m_kShapeArc.GetCurveLength(0) - m_fAccumAnimOffset;
float linelenth = (m_fArrowHeadLenth*0.04f)/2 + 0.764f;
var linelenth = m_fArrowHeadLenth * 0.04f / 2 + 0.764f;
if(fnowoffset>0&&fnowoffset<= m_fHigh)
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",fnowoffset/m_fHigh);
}
else if(fnowoffset>m_fHigh && fnowoffset<=m_kShapeArc.GetCurveLength (0) - m_fHigh - linelenth)
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0.7f);
}
else if(fnowoffset>m_kShapeArc.GetCurveLength (0) - m_fHigh - linelenth && fnowoffset<=m_kShapeArc.GetCurveLength (0))
{
float f = (1 - ((fnowoffset - m_kShapeArc.GetCurveLength(0) + m_fHigh + linelenth) / m_fHigh)) * 0.7f;
if (fnowoffset > 0 && fnowoffset <= m_fHigh)
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", fnowoffset / m_fHigh);
}
else if (fnowoffset > m_fHigh && fnowoffset <= m_kShapeArc.GetCurveLength(0) - m_fHigh - linelenth)
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0.7f);
}
else if (fnowoffset > m_kShapeArc.GetCurveLength(0) - m_fHigh - linelenth &&
fnowoffset <= m_kShapeArc.GetCurveLength(0))
{
var f = (1 - (fnowoffset - m_kShapeArc.GetCurveLength(0) + m_fHigh + linelenth) / m_fHigh) * 0.7f;
//if (f > 0.05f)
//{
// f = 1;
//}
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",f);
}
else
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
}
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", f);
}
else
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
//float linelenth = m_kShapeArc.GetCurveLength (0)/5;
//设置alpha
//float linelenth = m_kShapeArc.GetCurveLength (0)/5;
//设置alpha
// if(fnowoffset>0&&fnowoffset<= linelenth)
// {
// this.gameObject.renderer.material.SetFloat("_Alpha",fnowoffset/linelenth);
......@@ -153,21 +136,31 @@ public class AnimUnit : MonoBehaviour
// {
// this.gameObject.renderer.material.SetFloat("_Alpha",0);
// }
}
public void setMegaShape(MegaShapeArc msa)
{
m_kShapeArc = msa;
}
public float getAccumOffset()
{
return m_fAccumAnimOffset;
}
public void setAccumOffset(float val)
{
m_fAccumAnimOffset = val;
}
}
}
// void AlphaSet()
// {
// m_kShapeArc.GetCurveLength (0);
// }
public void SetAllAlphaZero()
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
public void setMegaShape(MegaShapeArc msa)
{
m_kShapeArc = msa;
}
public float getAccumOffset()
{
return m_fAccumAnimOffset;
}
public void setAccumOffset(float val)
{
m_fAccumAnimOffset = val;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class LoopMegaCtrl : MonoBehaviour {
// Use this for initialization
private float m_offsetZ;
private float m_offsetpercent;
private float m_pathLenth;
public GameObject Path = null;
float m_ObjectLenth;
float m_fBeforeLenth = 0.0f;
public int m_iID;
public GameObject m_kFirstOb = null;
bool m_bneedtoFollow = true;
public int m_iCount = 0;
void Start () {
//物体长度 --CardGame
m_ObjectLenth = 0.9f*0.02f;
//this.GetComponent<MegaWorldPathDeform>().animate = false;
//this.GetComponent<MegaWorldPathDeform>().percent = 0;
}
// Update is called once per frame
void Update () {
}
void LateUpdate()
{
LoopMegaAntmation();
}
void LoopMegaAntmation()
{
//if(m_offsetZ>0)
//{
//获得线段长度 --CardGame
if(m_bneedtoFollow && m_kFirstOb!=null )
{
this.GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = false;
}
public class LoopMegaCtrl : MonoBehaviour
{
public GameObject Path;
public int m_iID;
public GameObject m_kFirstOb;
public int m_iCount;
private bool m_bneedtoFollow = true;
private float m_fBeforeLenth;
private float m_ObjectLenth;
private float m_offsetpercent;
// Use this for initialization
private float m_offsetZ;
private float m_pathLenth;
private void Start()
{
//物体长度 --CardGame
m_ObjectLenth = 0.9f * 0.02f;
//this.GetComponent<MegaWorldPathDeform>().animate = false;
//this.GetComponent<MegaWorldPathDeform>().percent = 0;
}
// Update is called once per frame
private void Update()
{
}
private void LateUpdate()
{
LoopMegaAntmation();
}
private void LoopMegaAntmation()
{
//if(m_offsetZ>0)
//{
//获得线段长度 --CardGame
if (m_bneedtoFollow && m_kFirstOb != null)
{
GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = false;
}
// if(m_iCount>=5)
// {
......@@ -51,8 +51,7 @@ public class LoopMegaCtrl : MonoBehaviour {
// }
m_pathLenth=Path.GetComponent<MegaShapeArc>().GetCurveLength(0);
m_pathLenth = Path.GetComponent<MegaShapeArc>().GetCurveLength(0);
// if(m_fBeforeLenth>m_pathLenth)
// {
......@@ -70,37 +69,31 @@ public class LoopMegaCtrl : MonoBehaviour {
// {
// this.GetComponent<MegaWorldPathDeform>().animate = true;
// }
m_fBeforeLenth = m_pathLenth;
m_offsetZ = -this.GetComponent<MegaWorldPathDeform>().Offset.z;
m_offsetpercent = ((m_ObjectLenth + m_offsetZ)/m_pathLenth)*100;
//Debug.Log(this.name+":" + m_offsetpercent);
this.GetComponent<MegaWorldPathDeform>().path = Path.GetComponent<MegaShapeArc>();
if(this.GetComponent<MegaWorldPathDeform>().percent >= 100+m_offsetpercent)
{
//调整位置方法 --CardGame
if(m_kFirstOb!=null)
{
Debug.Log ("else follow first");
this.GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = true;
}
else
{
Debug.Log ("first to 0");
this.GetComponent<MegaWorldPathDeform>().percent = 0;
}
}
}
}
m_fBeforeLenth = m_pathLenth;
m_offsetZ = -GetComponent<MegaWorldPathDeform>().Offset.z;
m_offsetpercent = (m_ObjectLenth + m_offsetZ) / m_pathLenth * 100;
//Debug.Log(this.name+":" + m_offsetpercent);
GetComponent<MegaWorldPathDeform>().path = Path.GetComponent<MegaShapeArc>();
if (GetComponent<MegaWorldPathDeform>().percent >= 100 + m_offsetpercent)
{
//调整位置方法 --CardGame
if (m_kFirstOb != null)
{
Debug.Log("else follow first");
GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = true;
}
else
{
Debug.Log("first to 0");
GetComponent<MegaWorldPathDeform>().percent = 0;
}
}
}
}
\ No newline at end of file

using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LoopPathAnim : MonoBehaviour
public class LoopPathAnim : MonoBehaviour
{
public List<MegaWorldPathDeform> m_kMWPD_List =
new List<MegaWorldPathDeform>();
public float m_fOffsetValueStep = 1.0f;
// public GameObject m_kStartObject = null;
// public GameObject m_kEndObject = null;
private MegaShapeArc m_kShapeArc = null;
public List<MegaWorldPathDeform> m_kMWPD_List =
new List<MegaWorldPathDeform>();
public float m_fOffsetValueStep = 1.0f;
private MegaShapeArc m_kShapeArc;
void Start ()
{
m_kShapeArc = GetComponent<MegaShapeArc> ();
private void Start()
{
m_kShapeArc = GetComponent<MegaShapeArc>();
// m_kStartObject.transform.position = m_kShapeArc.splines [0].knots [0].p;
// m_kEndObject.transform.position =
// m_kShapeArc.splines [0].knots[ m_kShapeArc.splines [0].knots.Count-1 ].p;
foreach(MegaWorldPathDeform iter in m_kMWPD_List)
{
if( iter.GetComponent<AnimUnit>() )
{
iter.GetComponent<AnimUnit>().setMegaShape(m_kShapeArc);
//Debug.Log("set shaps...");
}
}
}
foreach (var iter in m_kMWPD_List)
if (iter.GetComponent<AnimUnit>())
iter.GetComponent<AnimUnit>().setMegaShape(m_kShapeArc);
//Debug.Log("set shaps...");
}
void Update ()
{
}
private void Update()
{
}
void LateUpdate()
{
private void LateUpdate()
{
// m_kShapeArc.splines [0].knots [0].p = m_kStartObject.transform.position;
//
// m_kShapeArc.splines [0].knots [m_kShapeArc.splines [0].knots.Count - 1].p =
// m_kEndObject.transform.position;
}
//得到曲线路径长度 --CardGame
public float getShapeLen()
{
return m_kShapeArc.GetCurveLength(0);
}
//添加到箭头组成尾部 --CardGame
public void moveToTail(MegaWorldPathDeform mwpd)
{
if( m_kMWPD_List.Contains(mwpd) )
{
float val =
m_kMWPD_List[m_kMWPD_List.Count-1].
GetComponent<AnimUnit>().getAccumOffset() + m_fOffsetValueStep;
mwpd.GetComponent<AnimUnit>().setAccumOffset(val);
m_kMWPD_List.Remove(mwpd);
m_kMWPD_List.Add(mwpd);
}
}
}
}
//得到曲线路径长度 --CardGame
public float getShapeLen()
{
return m_kShapeArc.GetCurveLength(0);
}
//添加到箭头组成尾部 --CardGame
public void moveToTail(MegaWorldPathDeform mwpd)
{
if (m_kMWPD_List.Contains(mwpd))
{
var val =
m_kMWPD_List[m_kMWPD_List.Count - 1].GetComponent<AnimUnit>().getAccumOffset() + m_fOffsetValueStep;
mwpd.GetComponent<AnimUnit>().setAccumOffset(val);
m_kMWPD_List.Remove(mwpd);
m_kMWPD_List.Add(mwpd);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class RendMega : MonoBehaviour {
public class RendMega : MonoBehaviour
{
public Vector3 StartPosition = Vector3.zero;
public Vector3 FingerPosition = Vector3.zero;
public Transform SkillPosition;
public Transform SkillPositionForm;
public GameObject m_kPath;
public Vector3 StartPosition = Vector3.zero;
public Vector3 FingerPosition = Vector3.zero;
public Transform SkillPosition = null;
public Transform SkillPositionForm = null;
public GameObject m_kPath = null;
public float k = 3f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update()
{
MyRenderPath();
// Use this for initialization
private void Start()
{
}
}
// Update is called once per frame
private void Update()
{
MyRenderPath();
}
public void MyRenderPath()
{
public void MyRenderPath()
{
m_kPath.transform.localScale = new Vector3(k, k, k);
Vector3 v3FromPos = SkillPosition.position/k;
Vector3 v3TargetPos = SkillPositionForm.position/k;
Vector3 v3MidPos = (v3FromPos + v3TargetPos)/2;
var v3FromPos = SkillPosition.position / k;
var v3TargetPos = SkillPositionForm.position / k;
var v3MidPos = (v3FromPos + v3TargetPos) / 2;
v3MidPos += new Vector3(0, Vector3.Distance(v3TargetPos, v3FromPos) / 10f * 3f, 0);
v3MidPos += (v3TargetPos - v3FromPos) / 10f * 3f;
Vector3 V3Midvect = (v3TargetPos - v3FromPos)/4;
var V3Midvect = (v3TargetPos - v3FromPos) / 4;
Vector3 v3FromAnchorIn = v3FromPos+new Vector3(0,-(v3MidPos.y/3),0) ;
var v3FromAnchorIn = v3FromPos + new Vector3(0, -(v3MidPos.y / 3), 0);
//Vector3 v3FromAnchorOut = v3FromPos+new Vector3(0,(v3MidPos.y/3),0) ;
Vector3 v3FromAnchorOut = v3FromPos + V3Midvect;
var v3FromAnchorOut = v3FromPos + V3Midvect;
//Vector3 v3TarGetAnchorIn = v3TargetPos +new Vector3(0,(v3MidPos.y/3),0) ;
Vector3 v3TarGetAnchorIn = v3TargetPos + new Vector3(0, (v3MidPos.y / 3), 0) - V3Midvect/10;
Vector3 v3TarGetAnchorOut = v3TargetPos + new Vector3(0, -(v3MidPos.y / 3), 0);
var v3TarGetAnchorIn = v3TargetPos + new Vector3(0, v3MidPos.y / 3, 0) - V3Midvect / 10;
var v3TarGetAnchorOut = v3TargetPos + new Vector3(0, -(v3MidPos.y / 3), 0);
Vector3 v3MidAnchorIn = v3MidPos - V3Midvect;
Vector3 v3MidAnchorOut = v3MidPos + V3Midvect ;
var v3MidAnchorIn = v3MidPos - V3Midvect;
var v3MidAnchorOut = v3MidPos + V3Midvect;
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0,0,v3FromPos,v3FromAnchorIn,v3FromAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0,1,v3MidPos,v3MidAnchorIn,v3MidAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0,2,v3TargetPos,v3TarGetAnchorIn,v3TarGetAnchorOut);
}
}
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0, 0, v3FromPos, v3FromAnchorIn, v3FromAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0, 1, v3MidPos, v3MidAnchorIn, v3MidAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0, 2, v3TargetPos, v3TarGetAnchorIn, v3TarGetAnchorOut);
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class arrowCtrl : MonoBehaviour {
public class arrowCtrl : MonoBehaviour
{
public GameObject[] m_karrow;
public GameObject[] m_karrow;
// Use this for initialization
void Start () {
}
// Use this for initialization
private void Start()
{
}
public void AllAlphaZero()
{
for(int i = 0;i<m_karrow.Length;i++)
{
if(m_karrow[i].GetComponent<AnimUnit>()!=null)
{
m_karrow[i].GetComponent<AnimUnit>().SetAllAlphaZero();
}
}
}
}
public void AllAlphaZero()
{
for (var i = 0; i < m_karrow.Length; i++)
if (m_karrow[i].GetComponent<AnimUnit>() != null)
m_karrow[i].GetComponent<AnimUnit>().SetAllAlphaZero();
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class blinding : MonoBehaviour {
public class blinding : MonoBehaviour
{
// Use this for initialization
private void Start()
{
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", (1f + Mathf.Sin(Time.time*10)) / 2f);
// Update is called once per frame
private void Update()
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", (1f + Mathf.Sin(Time.time * 10)) / 2f);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: b71b024f995aa0843a87af2b3fae595e
folderAsset: yes
timeCreated: 1482167356
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class arrow : MonoBehaviour {
public class arrow : MonoBehaviour
{
public float speed = 1;
public Transform from;
public Transform to;
public RendMega mega;
public MegaShapeArc arc;
// Use this for initialization
void Start ()
private void Start()
{
updateSpeed();
}
// Update is called once per frame
private void Update()
{
}
public void updateSpeed()
{
var list = GetComponentsInChildren<AnimUnit>();
foreach (var item in list)
{
item.m_fspeed = speed;
}
foreach (var item in list) item.m_fspeed = speed;
}
// Update is called once per frame
void Update () {
}
}
}
\ No newline at end of file

using UnityEngine;
using System.Collections;
using UnityEngine;
//设置在编辑模式下也执行该脚本
[ExecuteInEditMode]
......@@ -8,11 +6,32 @@ using System.Collections;
[AddComponentMenu("Learning Unity Shader/Lecture 15/RapidBlurEffect")]
public class RapidBlurEffect : MonoBehaviour
{
//-------------------------材质的get&set----------------------------
#region MaterialGetAndSet
private Material material
{
get
{
if (CurMaterial == null)
{
CurMaterial = new Material(CurShader);
CurMaterial.hideFlags = HideFlags.HideAndDontSave;
}
return CurMaterial;
}
}
#endregion
//-------------------变量声明部分-------------------
#region Variables
//指定Shader名称
private string ShaderName = "Learning Unity Shader/Lecture 15/RapidBlurEffect";
private readonly string ShaderName = "Learning Unity Shader/Lecture 15/RapidBlurEffect";
//着色器和材质实例
public Shader CurShader;
......@@ -24,38 +43,25 @@ public class RapidBlurEffect : MonoBehaviour
public static int ChangeValue3;
//降采样次数
[Range(0, 6), Tooltip("[降采样次数]向下采样的次数。此值越大,则采样间隔越大,需要处理的像素点越少,运行速度越快。")]
[Range(0, 6)] [Tooltip("[降采样次数]向下采样的次数。此值越大,则采样间隔越大,需要处理的像素点越少,运行速度越快。")]
public int DownSampleNum = 2;
//模糊扩散度
[Range(0.0f, 20.0f), Tooltip("[模糊扩散度]进行高斯模糊时,相邻像素点的间隔。此值越大相邻像素间隔越远,图像越模糊。但过大的值会导致失真。")]
[Range(0.0f, 20.0f)] [Tooltip("[模糊扩散度]进行高斯模糊时,相邻像素点的间隔。此值越大相邻像素间隔越远,图像越模糊。但过大的值会导致失真。")]
public float BlurSpreadSize = 3.0f;
//迭代次数
[Range(0, 8), Tooltip("[迭代次数]此值越大,则模糊操作的迭代次数越多,模糊效果越好,但消耗越大。")]
[Range(0, 8)] [Tooltip("[迭代次数]此值越大,则模糊操作的迭代次数越多,模糊效果越好,但消耗越大。")]
public int BlurIterations = 3;
#endregion
//-------------------------材质的get&set----------------------------
#region MaterialGetAndSet
Material material
{
get
{
if (CurMaterial == null)
{
CurMaterial = new Material(CurShader);
CurMaterial.hideFlags = HideFlags.HideAndDontSave;
}
return CurMaterial;
}
}
#endregion
#region Functions
//-----------------------------------------【Start()函数】---------------------------------------------
// 说明:此函数仅在Update函数第一次被调用前被调用
//--------------------------------------------------------------------------------------------------------
void Start()
private void Start()
{
//依次赋值
ChangeValue = DownSampleNum;
......@@ -69,55 +75,54 @@ public class RapidBlurEffect : MonoBehaviour
if (!SystemInfo.supportsImageEffects)
{
enabled = false;
return;
}
}
//-------------------------------------【OnRenderImage()函数】------------------------------------
// 说明:此函数在当完成所有渲染图片后被调用,用来渲染图片后期效果
//--------------------------------------------------------------------------------------------------------
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
private void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
{
//着色器实例不为空,就进行参数设置
if (CurShader != null)
{
//【0】参数准备
//根据向下采样的次数确定宽度系数。用于控制降采样后相邻像素的间隔
float widthMod = 1.0f / (1.0f * (1 << DownSampleNum));
var widthMod = 1.0f / (1.0f * (1 << DownSampleNum));
//Shader的降采样参数赋值
material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod);
//设置渲染模式:双线性
sourceTexture.filterMode = FilterMode.Bilinear;
//通过右移,准备长、宽参数值
int renderWidth = sourceTexture.width >> DownSampleNum;
int renderHeight = sourceTexture.height >> DownSampleNum;
var renderWidth = sourceTexture.width >> DownSampleNum;
var renderHeight = sourceTexture.height >> DownSampleNum;
// 【1】处理Shader的通道0,用于降采样 ||Pass 0,for down sample
//准备一个缓存renderBuffer,用于准备存放最终数据
RenderTexture renderBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
var renderBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
//设置渲染模式:双线性
renderBuffer.filterMode = FilterMode.Bilinear;
//拷贝sourceTexture中的渲染数据到renderBuffer,并仅绘制指定的pass0的纹理数据
Graphics.Blit(sourceTexture, renderBuffer, material, 0);
//【2】根据BlurIterations(迭代次数),来进行指定次数的迭代操作
for (int i = 0; i < BlurIterations; i++)
for (var i = 0; i < BlurIterations; i++)
{
//【2.1】Shader参数赋值
//迭代偏移量参数
float iterationOffs = (i * 1.0f);
var iterationOffs = i * 1.0f;
//Shader的降采样参数赋值
material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod + iterationOffs);
// 【2.2】处理Shader的通道1,垂直方向模糊处理 || Pass1,for vertical blur
// 定义一个临时渲染的缓存tempBuffer
RenderTexture tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
var tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
// 拷贝renderBuffer中的渲染数据到tempBuffer,并仅绘制指定的pass1的纹理数据
Graphics.Blit(renderBuffer, tempBuffer, material, 1);
// 清空renderBuffer
RenderTexture.ReleaseTemporary(renderBuffer);
// 将tempBuffer赋给renderBuffer,此时renderBuffer里面pass0和pass1的数据已经准备好
renderBuffer = tempBuffer;
renderBuffer = tempBuffer;
// 【2.3】处理Shader的通道2,竖直方向模糊处理 || Pass2,for horizontal blur
// 获取临时渲染纹理
......@@ -136,7 +141,6 @@ public class RapidBlurEffect : MonoBehaviour
Graphics.Blit(renderBuffer, destTexture);
//清空renderBuffer
RenderTexture.ReleaseTemporary(renderBuffer);
}
//着色器实例为空,直接拷贝屏幕上的效果。此情况下是没有实现屏幕特效的
......@@ -151,7 +155,7 @@ public class RapidBlurEffect : MonoBehaviour
//-----------------------------------------【OnValidate()函数】--------------------------------------
// 说明:此函数在编辑器中该脚本的某个值发生了改变后被调用
//--------------------------------------------------------------------------------------------------------
void OnValidate()
private void OnValidate()
{
//将编辑器中的值赋值回来,确保在编辑器中值的改变立刻让结果生效
ChangeValue = DownSampleNum;
......@@ -162,7 +166,7 @@ public class RapidBlurEffect : MonoBehaviour
//-----------------------------------------【Update()函数】--------------------------------------
// 说明:此函数每帧都会被调用
//--------------------------------------------------------------------------------------------------------
void Update()
private void Update()
{
//若程序在运行,进行赋值
if (Application.isPlaying)
......@@ -174,27 +178,19 @@ public class RapidBlurEffect : MonoBehaviour
}
//若程序没有在运行,去寻找对应的Shader文件
#if UNITY_EDITOR
if (Application.isPlaying != true)
{
CurShader = Shader.Find(ShaderName);
}
if (Application.isPlaying != true) CurShader = Shader.Find(ShaderName);
#endif
}
//-----------------------------------------【OnDisable()函数】---------------------------------------
// 说明:当对象变为不可用或非激活状态时此函数便被调用
//--------------------------------------------------------------------------------------------------------
void OnDisable()
private void OnDisable()
{
if (CurMaterial)
{
//立即销毁材质实例
DestroyImmediate(CurMaterial);
}
}
#endregion
#endregion
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using UnityEngine;
public class UImouseHint : MonoBehaviour {
public class UImouseHint : MonoBehaviour
{
public GameObject point;
public Camera cam;
// Use this for initialization
void Start () {
private bool drag;
// Use this for initialization
private void Start()
{
try
{
cam = gameObject.transform.GetComponentInParent<UIRoot>().GetComponentInChildren<Camera>();
}
catch (System.Exception)
catch (Exception)
{
}
}
// Update is called once per frame
void Update()
}
// Update is called once per frame
private void Update()
{
if (drag)
{
point.transform.position = cam.ScreenToWorldPoint(new Vector3(
Input.mousePosition.x+5,
Input.mousePosition.y-25,0
));
}
Input.mousePosition.x + 5,
Input.mousePosition.y - 25, 0
));
}
bool drag = false;
public void begin()
{
drag = true;
......@@ -41,4 +42,4 @@ public class UImouseHint : MonoBehaviour {
drag = false;
point.SetActive(false);
}
}
}
\ No newline at end of file
using UnityEngine;
using System;
using TMPro;
using UnityEngine;
public class chainMono : MonoBehaviour {
public class chainMono : MonoBehaviour
{
public Renderer circle;
public TMPro.TextMeshPro text;
public TextMeshPro text;
public bool flashing = true;
float all = 0;
bool p = true;
void Update()
private float all;
private bool p = true;
private void Update()
{
if (flashing)
if (flashing)
{
all += Program.deltaTime;
if (all>0.05)
if (all > 0.05)
{
all = 0;
p = !p;
......@@ -29,4 +31,4 @@ public class chainMono : MonoBehaviour {
}
}
}
}
}
\ No newline at end of file
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(ParticleScale))]
public class ParticleScaleEditor : Editor {
void Awake() {
foreach(Transform tr in tgt.transform) {
if(tr.gameObject.GetComponent<ParticleScale>() == null) {
tr.gameObject.AddComponent<ParticleScale>();
}
}
}
public class ParticleScaleEditor : Editor
{
public ParticleScale tgt => target as ParticleScale;
public override void OnInspectorGUI() {
tgt.scaleStep = EditorGUILayout.FloatField("Scale Step", tgt.scaleStep);
private void Awake()
{
foreach (Transform tr in tgt.transform)
if (tr.gameObject.GetComponent<ParticleScale>() == null)
tr.gameObject.AddComponent<ParticleScale>();
}
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
public override void OnInspectorGUI()
{
tgt.scaleStep = EditorGUILayout.FloatField("Scale Step", tgt.scaleStep);
if(GUILayout.Button(new GUIContent("Scale Up"), GUILayout.Width(80))) {
UpdateScale(tgt.scaleStep);
}
if(GUILayout.Button(new GUIContent("Scale Down"), GUILayout.Width(80))) {
ReduceScale(tgt.scaleStep);
}
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator();
}
if (GUILayout.Button(new GUIContent("Scale Up"), GUILayout.Width(80))) UpdateScale(tgt.scaleStep);
private void UpdateScale(float mod) {
tgt.UpdateScale(mod);
foreach(Transform tr in tgt.transform) {
if(tr.gameObject.GetComponent<ParticleScale>() == null) {
tr.gameObject.AddComponent<ParticleScale>();
}
if (GUILayout.Button(new GUIContent("Scale Down"), GUILayout.Width(80))) ReduceScale(tgt.scaleStep);
tr.gameObject.GetComponent<ParticleScale>().UpdateScale(mod);
}
}
private void ReduceScale(float mod) {
tgt.ReduceScale(mod);
foreach(Transform tr in tgt.transform) {
if(tr.gameObject.GetComponent<ParticleScale>() == null) {
tr.gameObject.AddComponent<ParticleScale>();
}
tr.gameObject.GetComponent<ParticleScale>().ReduceScale(mod);
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator();
}
public ParticleScale tgt {
get {
return target as ParticleScale;
}
}
private void UpdateScale(float mod)
{
tgt.UpdateScale(mod);
foreach (Transform tr in tgt.transform)
{
if (tr.gameObject.GetComponent<ParticleScale>() == null) tr.gameObject.AddComponent<ParticleScale>();
tr.gameObject.GetComponent<ParticleScale>().UpdateScale(mod);
}
}
private void ReduceScale(float mod)
{
tgt.ReduceScale(mod);
foreach (Transform tr in tgt.transform)
{
if (tr.gameObject.GetComponent<ParticleScale>() == null) tr.gameObject.AddComponent<ParticleScale>();
}
tr.gameObject.GetComponent<ParticleScale>().ReduceScale(mod);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class ParticleScale : MonoBehaviour {
public class ParticleScale : MonoBehaviour
{
public float scaleStep = 0.1f;
public float scaleStep = 0.1f;
private ParticleSystem _particle;
private ParticleSystem _particle = null;
public ParticleSystem particle
{
get
{
if (_particle == null) _particle = GetComponent<ParticleSystem>();
return _particle;
}
}
public void UpdateScale(float mod) {
if(particle == null) {
return;
}
public void UpdateScale(float mod)
{
if (particle == null) return;
particle.startSize = particle.startSize + particle.startSize * mod;
particle.startSpeed = particle.startSpeed + particle.startSpeed * mod;
}
particle.startSize = particle.startSize + particle.startSize * mod;
particle.startSpeed = particle.startSpeed + particle.startSpeed * mod;
}
public void ReduceScale(float mod) {
if(particle == null) {
return;
}
public void ReduceScale(float mod)
{
if (particle == null) return;
particle.startSize = particle.startSize - particle.startSize * mod;
particle.startSpeed = particle.startSpeed - particle.startSpeed * mod;
}
public ParticleSystem particle {
get {
if(_particle == null) {
_particle = GetComponent<ParticleSystem>();
}
return _particle;
}
}
}
particle.startSize = particle.startSize - particle.startSize * mod;
particle.startSpeed = particle.startSpeed - particle.startSpeed * mod;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class Galaxy_Rotation_01 : MonoBehaviour {
public class Galaxy_Rotation_01 : MonoBehaviour
{
// Use this for initialization
private void Start()
{
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// Slowly rotate the object around its X axis at 1 degree/second.
transform.Rotate(Vector3.forward * Time.deltaTime*-10);
}
}
// Update is called once per frame
private void Update()
{
// Slowly rotate the object around its X axis at 1 degree/second.
transform.Rotate(Vector3.forward * Time.deltaTime * -10);
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using DG.Tweening;
public class MonoCardInDeckManager : MonoBehaviour {
int loadedPicCode = 0;
YGOSharp.Banlist loaded_banlist = null;
public bool dying = false;
bool died = false;
public YGOSharp.Card cardData=new YGOSharp.Card();
void Update ()
using DG.Tweening;
using UnityEngine;
using YGOSharp;
public class MonoCardInDeckManager : MonoBehaviour
{
public bool dying;
private bool bool_physicalON;
public Card cardData = new Card();
private bool died;
private bool isDraging;
private Banlist loaded_banlist;
private int loadedPicCode;
private void Update()
{
if (loadedPicCode != cardData.Id)
{
Texture2D pic = GameTextureManager.get(cardData.Id,GameTextureType.card_picture);
var pic = GameTextureManager.get(cardData.Id, GameTextureType.card_picture);
if (pic != null)
{
loadedPicCode = cardData.Id;
gameObject.transform.Find("face").GetComponent<Renderer>().material.mainTexture = pic;
}
}
if (Program.I().deckManager.currentBanlist != loaded_banlist)
{
ban_icon ico = GetComponentInChildren<ban_icon>();
var ico = GetComponentInChildren<ban_icon>();
loaded_banlist = Program.I().deckManager.currentBanlist;
if (loaded_banlist != null)
{
ico.show(loaded_banlist.GetQuantity(cardData.Id));
}
else
{
ico.show(3);
}
}
if (isDraging)
{
gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f;
}
if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON)
{
killIt();
}
if (isDraging) gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f;
if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON) killIt();
}
public void killIt()
......@@ -50,15 +46,9 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
gameObject.transform.position = new Vector3(0, 5, 0);
endDrag();
if (Program.I().deckManager.cardInDragging==this)
{
Program.I().deckManager.cardInDragging = null;
}
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
if (Program.I().deckManager.cardInDragging == this) Program.I().deckManager.cardInDragging = null;
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
rigidbody.Sleep();
}
else
......@@ -71,22 +61,20 @@ public class MonoCardInDeckManager : MonoBehaviour {
public Vector3 getGoodPosition(float height)
{
float x = Input.mousePosition.x;
float y = Input.mousePosition.y;
Vector3 to_ltemp = Program.I().main_camera.ScreenToWorldPoint(new Vector3(x, y, 1));
Vector3 dv = to_ltemp - Program.I().main_camera.transform.position;
var x = Input.mousePosition.x;
var y = Input.mousePosition.y;
var to_ltemp = Program.I().main_camera.ScreenToWorldPoint(new Vector3(x, y, 1));
var dv = to_ltemp - Program.I().main_camera.transform.position;
if (dv.y == 0) dv.y = 0.01f;
to_ltemp.x = ((height - Program.I().main_camera.transform.position.y)
* (dv.x) / dv.y + Program.I().main_camera.transform.position.x);
to_ltemp.y = ((height - Program.I().main_camera.transform.position.y)
* (dv.y) / dv.y + Program.I().main_camera.transform.position.y);
to_ltemp.z = ((height - Program.I().main_camera.transform.position.y)
* (dv.z) / dv.y + Program.I().main_camera.transform.position.z);
to_ltemp.x = (height - Program.I().main_camera.transform.position.y)
* dv.x / dv.y + Program.I().main_camera.transform.position.x;
to_ltemp.y = (height - Program.I().main_camera.transform.position.y)
* dv.y / dv.y + Program.I().main_camera.transform.position.y;
to_ltemp.z = (height - Program.I().main_camera.transform.position.y)
* dv.z / dv.y + Program.I().main_camera.transform.position.z;
return to_ltemp;
}
bool isDraging = false;
public void beginDrag()
{
physicalOFF();
......@@ -101,21 +89,18 @@ public class MonoCardInDeckManager : MonoBehaviour {
isDraging = false;
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || getIfAlive() == false)
{
Vector3 form_position = getGoodPosition(4);
Vector3 to_position = getGoodPosition(0);
Vector3 delta_position = to_position - form_position;
var form_position = getGoodPosition(4);
var to_position = getGoodPosition(0);
var delta_position = to_position - form_position;
GetComponent<Rigidbody>().AddForce(delta_position * 1000);
dying = true;
}
}
public void tweenToVectorAndFall(Vector3 position,Vector3 rotation)
public void tweenToVectorAndFall(Vector3 position, Vector3 rotation)
{
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null)
{
rigidbody.Sleep();
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null) rigidbody.Sleep();
transform.DOMove(position, 0.2f).OnComplete(physicalON);
transform.DORotate(rotation, 0.15f);
......@@ -137,17 +122,12 @@ public class MonoCardInDeckManager : MonoBehaviour {
physicalOFF();
}
bool bool_physicalON = false;
private void physicalON()
{
bool_physicalON = true;
GetComponent<BoxCollider>().enabled = true;
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
rigidbody.Sleep();
rigidbody.useGravity = true;
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
......@@ -157,11 +137,8 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
bool_physicalON = false;
GetComponent<BoxCollider>().enabled = true;
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
rigidbody.useGravity = false;
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
}
......@@ -170,46 +147,34 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
bool_physicalON = false;
GetComponent<BoxCollider>().enabled = false;
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null)
{
rigidbody.useGravity = false;
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null) rigidbody.useGravity = false;
}
public bool getIfAlive()
{
bool ret = true;
if (died == true)
{
ret = false;
}
if (gameObject.transform.position.y < -0.5f)
{
ret = false;
}
Vector3 to_ltemp = refLectPosition(gameObject.transform.position);
var ret = true;
if (died) ret = false;
if (gameObject.transform.position.y < -0.5f) ret = false;
var to_ltemp = refLectPosition(gameObject.transform.position);
if (to_ltemp.x < -15.2f) ret = false;
if (to_ltemp.x > 15.2f) ret = false;
if (Program.I().deckManager.condition == DeckManager.Condition.changeSide)
{
ret = true;
}
if (Program.I().deckManager.condition == DeckManager.Condition.changeSide) ret = true;
return ret;
}
public static Vector3 refLectPosition(Vector3 pos)
{
Vector3 to_ltemp = pos;
Vector3 dv = to_ltemp - Program.I().main_camera.transform.position;
var to_ltemp = pos;
var dv = to_ltemp - Program.I().main_camera.transform.position;
if (dv.y == 0) dv.y = 0.01f;
to_ltemp.x = ((0 - Program.I().main_camera.transform.position.y)
* (dv.x) / dv.y + Program.I().main_camera.transform.position.x);
to_ltemp.y = ((0 - Program.I().main_camera.transform.position.y)
* (dv.y) / dv.y + Program.I().main_camera.transform.position.y);
to_ltemp.z = ((0 - Program.I().main_camera.transform.position.y)
* (dv.z) / dv.y + Program.I().main_camera.transform.position.z);
to_ltemp.x = (0 - Program.I().main_camera.transform.position.y)
* dv.x / dv.y + Program.I().main_camera.transform.position.x;
to_ltemp.y = (0 - Program.I().main_camera.transform.position.y)
* dv.y / dv.y + Program.I().main_camera.transform.position.y;
to_ltemp.z = (0 - Program.I().main_camera.transform.position.y)
* dv.z / dv.y + Program.I().main_camera.transform.position.z;
return to_ltemp;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using YGOSharp;
public class cardPicLoader : MonoBehaviour
{
public int loaded_code = -1;
public int code = 0;
public YGOSharp.Banlist loaded_banlist = null;
public int code;
public Texture2D defaults = null;
public Texture2D defaults;
public ban_icon ico;
public void clear()
{
loaded_code = 0;
code = 0;
ico.show(3);
uiTexture.mainTexture = null;
}
public Collider coli;
public void reCode(int c)
{
loaded_code = 0;
code = c;
}
public UITexture uiTexture;
public void relayer(int l)
{
uiTexture.depth = 50 + l * 2;
UITexture t = ico.gameObject.GetComponent<UITexture>();
t.depth = 51 + l * 2;
}
public Banlist loaded_banlist;
public Collider coli = null;
public Card data { get; set; }
void Update()
private void Update()
{
if (coli != null)
{
if (Program.InputGetMouseButtonDown_0)
{
if (Program.pointedCollider == coli)
{
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
}
}
}
Program.I().cardDescription.setData(CardsManager.Get(code), GameTextureManager.myBack, "", true);
if (Program.I().deckManager != null)
{
if (loaded_code != code)
{
Texture2D t = GameTextureManager.get(code, GameTextureType.card_picture, defaults);
var t = GameTextureManager.get(code, GameTextureType.card_picture, defaults);
if (t != null)
{
uiTexture.mainTexture = t;
uiTexture.aspectRatio = ((float)t.width) / ((float)t.height);
uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio));
uiTexture.aspectRatio = t.width / (float) t.height;
uiTexture.forceWidth((int) (uiTexture.height * uiTexture.aspectRatio));
loaded_code = code;
loaded_banlist = null;
}
}
if (loaded_banlist != Program.I().deckManager.currentBanlist)
{
loaded_banlist = Program.I().deckManager.currentBanlist;
......@@ -73,13 +50,31 @@ public class cardPicLoader : MonoBehaviour
ico.show(3);
return;
}
ico.show(loaded_banlist.GetQuantity(code));
}
}
}
}
public UITexture uiTexture;
public void clear()
{
loaded_code = 0;
code = 0;
ico.show(3);
uiTexture.mainTexture = null;
}
public YGOSharp.Card data { get; set; }
}
public void reCode(int c)
{
loaded_code = 0;
code = c;
}
public void relayer(int l)
{
uiTexture.depth = 50 + l * 2;
var t = ico.gameObject.GetComponent<UITexture>();
t.depth = 51 + l * 2;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class descKeeper : MonoBehaviour {
public class descKeeper : MonoBehaviour
{
public UITexture card;
public UITexture back;
// Use this for initialization
void Start()
private void Start()
{
}
// Update is called once per frame
void Update () {
if (back.width < card.width)
{
back.width = card.width + 2;
}
private void Update()
{
if (back.width < card.width) back.width = card.width + 2;
back.transform.localPosition = new Vector3(back.width / 2f, 0);
Vector3 leftTop = new Vector3(-back.width / 2 + 2 + back.transform.localPosition.x, +back.height / 2 - 2 + back.transform.localPosition.y);
var leftTop = new Vector3(-back.width / 2 + 2 + back.transform.localPosition.x,
+back.height / 2 - 2 + back.transform.localPosition.y);
card.transform.localPosition = new Vector3(leftTop.x + card.width / 2, leftTop.y - card.height / 2);
Program.I().cardDescription.width = back.width-2;
Program.I().cardDescription.width = back.width - 2;
Program.I().cardDescription.cHeight = card.height;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using UnityEngine;
public class forceColor : MonoBehaviour {
// Use this for initialization
void Start () {
public class forceColor : MonoBehaviour
{
// Use this for initialization
private void Start()
{
var tweens = GetComponentsInChildren<TweenColor>();
foreach (var item in tweens)
{
DestroyImmediate(item);
}
foreach (var item in tweens) DestroyImmediate(item);
Color c;
ColorUtility.TryParseHtmlString(Config.Getui("allUI.color"), out c);
var sprites = GetComponentsInChildren<UISprite>();
foreach (var item in sprites)
{
foreach (var item in sprites)
if (item.color.a > 0.1f)
{
item.color = c;
......@@ -22,11 +19,11 @@ public class forceColor : MonoBehaviour {
{
item.gameObject.GetComponentInParent<UIButton>().defaultColor = c;
}
catch (System.Exception)
catch (Exception)
{
}
}
}
ColorUtility.TryParseHtmlString(Config.Getui("List.color"), out c);
var lists = GetComponentsInChildren<UIPopupList>();
foreach (var item in lists)
......@@ -37,10 +34,11 @@ public class forceColor : MonoBehaviour {
item.gameObject.GetComponent<UISprite>().color = c;
item.gameObject.GetComponent<UIButton>().defaultColor = c;
}
catch (System.Exception)
catch (Exception)
{
}
}
ColorUtility.TryParseHtmlString(Config.Getui("lable.color"), out c);
var ls = GetComponentsInChildren<UILabel>();
foreach (var item in ls)
......@@ -49,16 +47,14 @@ public class forceColor : MonoBehaviour {
item.gradientTop = c;
item.gradientBottom = Color.gray;
}
ColorUtility.TryParseHtmlString(Config.Getui("lable.color.fadecolor"), out c);
ls = GetComponentsInChildren<UILabel>();
foreach (var item in ls)
{
item.gradientBottom = c;
}
foreach (var item in ls) item.gradientBottom = c;
}
// Update is called once per frame
private void Update()
{
}
// Update is called once per frame
void Update () {
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
using UnityEngine;
using System.Collections;
using System;
using System;
using UnityEngine;
using Random = UnityEngine.Random;
public class priority_floating : MonoBehaviour
{
int open = 0;
private int open;
// Use this for initialization
void Start()
private void Start()
{
open = Program.TimePassed() - UnityEngine.Random.Range(0, 500);
open = Program.TimePassed() - Random.Range(0, 500);
}
// Update is called once per frame
void Update()
private void Update()
{
gameObject.transform.localPosition = new Vector3(0, 10*(float)Math.Sin(3.1415936f * (float)(Program.TimePassed() - open) / 500f), 0);
gameObject.transform.localPosition =
new Vector3(0, 10 * (float) Math.Sin(3.1415936f * (Program.TimePassed() - open) / 500f), 0);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class spriteChanger : MonoBehaviour {
public class spriteChanger : MonoBehaviour
{
public UITexture toBeChangedUITexture;
public Texture2D[] texts = new Texture2D[6];
public void change(int i)
{
if(i>0){
if (i > 0)
if (i < texts.Length)
{
toBeChangedUITexture.mainTexture=texts[i];
}
}
toBeChangedUITexture.mainTexture = texts[i];
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class mouseParticle : MonoBehaviour {
public class mouseParticle : MonoBehaviour
{
public Camera camera;
public ParticleSystem e1;
public ParticleSystem e2;
public Transform trans;
private float time = 0;
// Use this for initialization
void Start () {
private void Start()
{
camera.depth = 99999;
}
float time = 0;
// Update is called once per frame
void Update () {
Vector3 screenPoint = Input.mousePosition;
// Update is called once per frame
private void Update()
{
var screenPoint = Input.mousePosition;
screenPoint.z = 10;
trans.position = camera.ScreenToWorldPoint(screenPoint);
......@@ -29,4 +34,4 @@ public class mouseParticle : MonoBehaviour {
e2.Stop();
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class panelKIller : MonoBehaviour {
UIPanel pan;
bool on = false;
public class panelKIller : MonoBehaviour
{
private bool on;
public void ini()
{
pan = GetComponentInChildren<UIPanel>();
}
private UIPanel pan;
public void set(bool r)
{
on = r;
if (pan != null)
{
if (r)
{
pan.alpha = 0;
}
}
}
// Update is called once per frame
void Update () {
private void Update()
{
if (pan != null)
{
float to =0;
if (on)
{
to = 1;
}
float to = 0;
if (on) to = 1;
if (Mathf.Abs(to - pan.alpha) > 0.1f)
{
pan.alpha += (to - pan.alpha) * Program.deltaTime * 18;
}
else
{
if (pan.alpha != to)
{
pan.alpha = to;
}
if (pan.alpha != to) pan.alpha = to;
}
}
}
}
public void ini()
{
pan = GetComponentInChildren<UIPanel>();
}
public void set(bool r)
{
on = r;
if (pan != null)
if (r)
pan.alpha = 0;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class faceShower : MonoBehaviour {
void Start () {
gameObject.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width/2,Screen.height*1.5f,0));
iTween.MoveToAction(gameObject, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height/2, 0)),0.6f,()=>{
iTween.ScaleToAction(gameObject,Vector3.zero, 0.6f, () => {
Destroy(gameObject);
}, 1f);
},0);
}
}
public class faceShower : MonoBehaviour
{
private void Start()
{
gameObject.transform.position = Program.I().camera_main_2d
.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
iTween.MoveToAction(gameObject,
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0)), 0.6f,
() => { iTween.ScaleToAction(gameObject, Vector3.zero, 0.6f, () => { Destroy(gameObject); }, 1f); });
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class handShower : MonoBehaviour
{
public Texture2D[] pics = new Texture2D[3];
public int op = 0;
public int me = 0;
public int op;
public int me;
public UITexture texture_0;
public UITexture texture_1;
public GameObject GameObject_0;
public GameObject GameObject_1;
void Start()
private void Start()
{
pics[0] = GameTextureManager.get("jiandao");
pics[1] = GameTextureManager.get("shitou");
pics[2] = GameTextureManager.get("bu");
texture_0.mainTexture = pics[me];
texture_1.mainTexture = pics[op];
GameObject_0.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_0, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f, () => {
Destroy(GameObject_0,0.3f);
}, 0);
GameObject_1.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_1, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f, () => {
Destroy(GameObject_1, 0.3f);
}, 0);
GameObject_0.transform.position = Program.I().camera_main_2d
.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_0,
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f,
() => { Destroy(GameObject_0, 0.3f); });
GameObject_1.transform.position = Program.I().camera_main_2d
.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_1,
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f,
() => { Destroy(GameObject_1, 0.3f); });
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class lazyBookbtns : MonoBehaviour {
public class lazyBookbtns : MonoBehaviour
{
public UILabel lable;
public UITextList textlist;
public UISprite back;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
public class lazyPlayer : MonoBehaviour {
using System;
using UnityEngine;
public class lazyPlayer : MonoBehaviour
{
public UIToggle prep;
public UIButton prepAsButton;
public UIButton prepAsCollider;
public UIButton prepAsCollider;
public UIButton kickAsButton;
public UISprite prepAsTexture;
public UISprite prepAsTexture;
public UILabel UILabel_name;
......@@ -22,63 +21,62 @@ public class lazyPlayer : MonoBehaviour {
public Transform transformOfPrepFore;
int me = 0;
private bool canKick;
public void ini()
{
me = int.Parse(gameObject.name);
setIfprepared(false);
setIfMe(false);
SetNotNull(false);
SetIFcanKick(false);
setName("");
}
private int me;
private bool mIfMe;
private string mName;
private bool NotNull;
public Action<int> onKick = null;
public Action<int, bool> onPrepareChanged = null;
// Use this for initialization
void Start ()
private void Start()
{
UIHelper.registEvent(prepAsButton, OnPrepClicked);
UIHelper.registEvent(kickAsButton, OnKickClicked);
// ini();
// ini();
}
// Update is called once per frame
void Update()
private void Update()
{
}
public void ini()
{
me = int.Parse(gameObject.name);
setIfprepared(false);
setIfMe(false);
SetNotNull(false);
SetIFcanKick(false);
setName("");
}
void OnPrepClicked()
private void OnPrepClicked()
{
if (onPrepareChanged != null)
{
onPrepareChanged(me, prep.value);
}
if (onPrepareChanged != null) onPrepareChanged(me, prep.value);
}
void OnKickClicked()
private void OnKickClicked()
{
Program.DEBUGLOG("OnKickClicked " + me.ToString());
if (onKick != null)
{
onKick(me);
}
Program.DEBUGLOG("OnKickClicked " + me);
if (onKick != null) onKick(me);
//setIfMe(!getIfMe());//bb
}
bool canKick = false;
public void SetIFcanKick(bool canKick_)
{
canKick = canKick_;
if (canKick)
{
kickAsButton.gameObject.SetActive(true);
}
else
{
kickAsButton.gameObject.SetActive(false);
}
}
public bool getIfcanKick()
......@@ -86,8 +84,6 @@ public class lazyPlayer : MonoBehaviour {
return canKick;
}
bool NotNull = false;
public void SetNotNull(bool notNull_)
{
NotNull = notNull_;
......@@ -108,8 +104,6 @@ public class lazyPlayer : MonoBehaviour {
return NotNull;
}
bool mIfMe = false;
public void setIfMe(bool isMe)
{
mIfMe = isMe;
......@@ -132,8 +126,6 @@ public class lazyPlayer : MonoBehaviour {
return mIfMe;
}
string mName;
public void setName(string name_)
{
mName = name_;
......@@ -153,10 +145,6 @@ public class lazyPlayer : MonoBehaviour {
return mName;
}
public Action<int, bool> onPrepareChanged = null;
public Action<int> onKick = null;
public void setIfprepared(bool preped)
{
prep.value = preped;
......@@ -166,4 +154,4 @@ public class lazyPlayer : MonoBehaviour {
{
return prep.value;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class spining : MonoBehaviour {
void Update () {
transform.localEulerAngles+=(Vector3.forward * Program.deltaTime * 160);
public class spining : MonoBehaviour
{
private void Update()
{
transform.localEulerAngles += Vector3.forward * Program.deltaTime * 160;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public enum superButtonType
{
act, attack, bp,
change, ep, mp,
no, see, set,
spsummon, summon, yes,
act,
attack,
bp,
change,
ep,
mp,
no,
see,
set,
spsummon,
summon,
yes
}
public class iconSetForButton : MonoBehaviour
{
public UITexture UITextureInButton;
public UILabel UILabelInButton;
public Texture2D act;
......@@ -26,9 +32,10 @@ public class iconSetForButton : MonoBehaviour
public Texture2D spsummon;
public Texture2D summon;
public Texture2D yes;
public void setTexture(superButtonType type)
{
switch (type)
switch (type)
{
case superButtonType.act:
UITextureInButton.mainTexture = act;
......@@ -67,12 +74,14 @@ public class iconSetForButton : MonoBehaviour
UITextureInButton.mainTexture = yes;
break;
}
Color c;
ColorUtility.TryParseHtmlString(Config.Getui("gameButtonSign.color"), out c);
UITextureInButton.color = c;
}
public void setText(string hint)
{
UILabelInButton.text = hint;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class hinter : MonoBehaviour {
public class hinter : MonoBehaviour
{
public string str;
bool loaded = false;
UIEventTrigger trigger = null;
// Use this for initialization
void Start () {
private bool loaded;
private GameObject obj;
private UIEventTrigger trigger;
// Use this for initialization
private void Start()
{
trigger = GetComponent<UIEventTrigger>();
if (trigger==null)
{
trigger = gameObject.AddComponent<UIEventTrigger>();
}
if (trigger == null) trigger = gameObject.AddComponent<UIEventTrigger>();
trigger.onHoverOver.Add(new EventDelegate(this, "in_"));
trigger.onHoverOut.Add(new EventDelegate(this, "out_"));
trigger.onPress.Add(new EventDelegate(this, "out_"));
}
GameObject obj;
// Update is called once per frame
private void Update()
{
if (loaded == false)
if (InterString.loaded)
{
loaded = true;
str = InterString.Get(str);
}
}
void in_()
private void in_()
{
Vector3 screenPosition = Program.I().camera_main_2d.WorldToScreenPoint(gameObject.GetComponentInChildren<UITexture>().gameObject.transform.position);
var screenPosition = Program.I().camera_main_2d
.WorldToScreenPoint(gameObject.GetComponentInChildren<UITexture>().gameObject.transform.position);
screenPosition.y += 45;
screenPosition.z = 0;
Vector3 worldPositin = Program.I().camera_main_2d.ScreenToWorldPoint(screenPosition);
obj = Program.I().create(Program.I().mod_simple_ngui_text, worldPositin, Vector3.zero, true, Program.I().ui_main_2d, true);
var worldPositin = Program.I().camera_main_2d.ScreenToWorldPoint(screenPosition);
obj = Program.I().create(Program.I().mod_simple_ngui_text, worldPositin, Vector3.zero, true,
Program.I().ui_main_2d);
obj.GetComponent<UILabel>().text = str;
obj.GetComponent<UILabel>().effectStyle = UILabel.Effect.Outline;
Program.I().destroy(obj, 5f, false, false);
Program.I().destroy(obj, 5f);
}
void out_()
{
if (obj!=null)
{
Program.I().destroy(obj, 0.6f, true, true);
}
}
// Update is called once per frame
void Update()
private void out_()
{
if (loaded == false)
{
if (InterString.loaded == true)
{
loaded = true;
str = InterString.Get(str);
}
}
if (obj != null) Program.I().destroy(obj, 0.6f, true, true);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using UnityEngine;
public class setbar : MonoBehaviour {
public void show(){
public class setbar : MonoBehaviour
{
public void show()
{
try
{
if (Program.I().setting.isShowed)
{
Program.I().setting.hide();
}
else
{
Program.I().setting.show();
}
}
catch (System.Exception)
catch (Exception)
{
}
}
public void book()
{
try
{
if (Program.I().book.isShowed)
{
Program.I().book.hide();
}
else
{
Program.I().book.show();
}
}
catch (System.Exception)
catch (Exception)
{
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class toolShift : MonoBehaviour {
public GameObject ObjectMust = null;
public GameObject ObjectOption = null;
public class toolShift : MonoBehaviour
{
public GameObject ObjectMust;
public GameObject ObjectOption;
void Update()
private void Update()
{
if (Program.InputEnterDown)
{
if (ObjectMust.name == "input_")
{
UIInput input = UIHelper.getByName<UIInput>(ObjectMust, "input_");
var input = UIHelper.getByName<UIInput>(ObjectMust, "input_");
if (input != null)
{
if (ObjectMust.transform.localPosition.y < 0)
......@@ -36,26 +35,21 @@ public class toolShift : MonoBehaviour {
}
}
}
}
}
public void shift()
{
Vector3 va = ObjectMust.transform.localPosition;
var va = ObjectMust.transform.localPosition;
if (ObjectOption == null)
{
if (va.y >= 0)
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
}
else
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, 0, va.z), 0.6f);
}
}
else
{
Vector3 vb = ObjectOption.transform.localPosition;
var vb = ObjectOption.transform.localPosition;
if (va.y > vb.y)
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
......@@ -68,4 +62,4 @@ public class toolShift : MonoBehaviour {
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment