static public int get_thickness(IntPtr l) { try { UnityEngine.UI.Extensions.UIPolygon self = (UnityEngine.UI.Extensions.UIPolygon)checkSelf(l); pushValue(l, self.thickness); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.UI.Extensions.UIPolygon o; o = new UnityEngine.UI.Extensions.UIPolygon(); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_fill(IntPtr l) { try { UnityEngine.UI.Extensions.UIPolygon self = (UnityEngine.UI.Extensions.UIPolygon)checkSelf(l); System.Boolean v; checkType(l, 2, out v); self.fill = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int set_VerticesDistances(IntPtr l) { try { UnityEngine.UI.Extensions.UIPolygon self = (UnityEngine.UI.Extensions.UIPolygon)checkSelf(l); System.Single[] v; checkType(l, 2, out v); self.VerticesDistances = v; return(0); } catch (Exception e) { return(error(l, e)); } }
public void CreateEnneagram(string seedString) { if (true || traitValues == null) { traitValues = new float[5]; Random.seed = seedString.GetHashCode(); for (int i = 0; i < 5; i++) { traitValues[i] = Random.Range(.3f, .7f); //traitValues[i] = 1; } } UnityEngine.UI.Extensions.UIPolygon poly = GetComponent <UnityEngine.UI.Extensions.UIPolygon>(); for (int i = 0; i < traitValues.Length; i++) { poly.VerticesDistances[i] = traitValues[i]; } poly.VerticesDistances[traitValues.Length] = poly.VerticesDistances[0]; if (false) { vertices = new Vector3[numTraits + 1]; vertices[0] = Vector3.zero; float degreesPerTrait = 360.0f / numTraits; for (int i = 0; i < numTraits; i++) { vertices[i + 1] = Quaternion.AngleAxis(degreesPerTrait * i, Vector3.forward) * Vector3.up * maxRadius * traitValues[i]; } int[] triangles = new int[3 * (numTraits + 1)]; for (int i = 0; i < numTraits; i++) { triangles[i * 3] = 0; triangles[(i * 3) + 2] = (i + 1) >= vertices.Length ? 1 : i + 1; triangles[i * 3 + 1] = (i + 2) >= vertices.Length ? 1 : i + 2; } //triangles[(numTraits)*3] = 0; //triangles[((numTraits)*3)+2] = numTraits; //triangles[(numTraits)*3 + 1] = 1; mesh = new Mesh(); mesh.name = "Enneagram Mesh"; mesh.vertices = vertices; mesh.triangles = triangles; GetComponent <MeshFilter>().mesh = mesh; } poly.zoop(); }
// btnId為-1代表不是依據亭icon上的按鈕產生另一亭的icon 是由Start()產生 public void CreateTingIcon(Vector2 pos, int sides, float rotateAngle, int btnId = -1) { //**************************************Icon***************************************** GameObject icon = new GameObject(); icon.transform.parent = this.transform; icon.transform.position = pos; icon.AddComponent <UnityEngine.UI.Extensions.UIPolygon>(); UnityEngine.UI.Extensions.UIPolygon uIPolygon = icon.GetComponent <UnityEngine.UI.Extensions.UIPolygon>(); uIPolygon.sides = sides; uIPolygon.id = IconList.Count; if (sides == (int)MainController.FormFactorSideType.FourSide) { initModelRotateAngle = 45; } else { initModelRotateAngle = 180; } float rotateAngleRevise = 0; //預設旋轉角度 if (btnId > 0) { rotateAngleRevise = (360.0f / sides / 2) * (float)((sides + btnId - ((btnId % 2 == 0)?0:1))); } uIPolygon.rotation = (rotateAngle + rotateAngleRevise) % 360; //關閉部分按鈕 if (btnId != -1) { uIPolygon.SetBtnDisableIndex((btnId % 2 == 0)?0:1); } IconList.Add(uIPolygon); //**************************************Model***************************************** float scale = 0.5f; Vector3 posInWorld = (new Vector3(pos.x - IconList[0].transform.position.x, 0, pos.y - IconList[0].transform.position.y)) * scale + MainController.Instance.buildingCenter; MainController.Instance.AddBuilding(posInWorld, (-uIPolygon.rotation + initModelRotateAngle + 360) % 360); MainController.Instance.SelectBuilding(uIPolygon.id); }
static public int DrawPolygon(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { UnityEngine.UI.Extensions.UIPolygon self = (UnityEngine.UI.Extensions.UIPolygon)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); self.DrawPolygon(a1); return(0); } else if (argc == 3) { UnityEngine.UI.Extensions.UIPolygon self = (UnityEngine.UI.Extensions.UIPolygon)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Single[] a2; checkType(l, 3, out a2); self.DrawPolygon(a1, a2); return(0); } else if (argc == 4) { UnityEngine.UI.Extensions.UIPolygon self = (UnityEngine.UI.Extensions.UIPolygon)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Single[] a2; checkType(l, 3, out a2); System.Single a3; checkType(l, 4, out a3); self.DrawPolygon(a1, a2, a3); return(0); } return(error(l, "No matched override function to call")); } catch (Exception e) { return(error(l, e)); } }