private void watchPosition() { if (rotation.z > maxLimit + eachDistance * 0.5f) { GameObject go = this.transform.childCount == 0 ? null : this.transform.GetChild(0).gameObject; ImageUIObjectsManager.SetLeft(go); GameObject imageObject = ImageUIObjectsManager.GetRight(this.transform); rotation.z -= sideLength; rotationTarget.z -= sideLength; } if (rotation.z < minLimit - eachDistance * 0.5f) { GameObject go = this.transform.childCount == 0 ? null : this.transform.GetChild(0).gameObject; ImageUIObjectsManager.SetRight(go); GameObject imageObject = ImageUIObjectsManager.GetLeft(this.transform); rotation.z += sideLength; rotationTarget.z += sideLength; } float targ = Mathf.Round(rotation.z / 4.5f); ID = (int)(targ + 10) % 7; }
void Awake() { if (instance == null) { instance = this; } }
private void registHandlers() { //When host gets get image network.RegisterHandler(protocol.Type.GetImage, (netMsg) => { refcount++; protocol.GetImage msg = netMsg.ReadMessage <protocol.GetImage>(); Debug.Log("Get Image : " + refcount + "/" + msg.maxstep); if (maxstep == 0) { maxstep = msg.maxstep; pixels = new byte[msg.width * msg.height * 4]; } for (int i = 0; i < msg.pixels.Length; i++) { pixels[msg.step * 1024 + i] = msg.pixels[i]; } if (refcount == msg.maxstep) { Debug.Log("Download Compeleted"); tex = new Texture2D(msg.width, msg.height, TextureFormat.RGBA32, false); tex.LoadRawTextureData(pixels); tex.Apply(); pixels = null; maxstep = 0; refcount = 0; ImageUIObjectsManager.SetTexture(tex); } }); }
//Check that ImageObject is in this wrapper void watchChild() { if (this.transform.childCount == 0) { if (ID == 0) { GameObject imageObject = ImageUIObjectsManager.GetLeft(this.transform); // Instantiate (ImagePrefab, this.transform); } else if (ID == 6) { GameObject imageObject = ImageUIObjectsManager.GetRight(this.transform); } else { if (RightWrapper.childCount != 0) { RightWrapper.GetChild(0).parent = this.transform; } } } else if (this.transform.childCount > 1) { if (ID == 0) { ImageUIObjectsManager.SetRight(this.transform.GetChild(0).gameObject); // GameObject.Destroy (); } else if (ID == 6) { ImageUIObjectsManager.SetLeft(this.transform.GetChild(0).gameObject); } else { if (RightWrapper.childCount != 0) { this.transform.GetChild(0).parent = RightWrapper; } } } }
//update Function for Released MODE void updateReleaseMotion(float dt) { //it was supposed to check if (ImageUITouch.HitObject == this.gameObject) { #if UNITY_EDITOR attachToUI(); scale.x = 0.15f; scale.y = 0.19f; scale.z = 0.03f; #elif UNITY_IPHONE if (ImageUITouch.Force < 5.0f) { scale.x = 0.15f * Mathf.Max(1.0f, ImageUITouch.Force) * 0.5f; scale.y = 0.19f * Mathf.Max(1.0f, ImageUITouch.Force) * 0.5f; scale.z = 0.03f; } else { attachToUI(); scale.x = 0.15f; scale.y = 0.19f; scale.z = 0.03f; } #endif } else { scale.x = 0.15f; scale.y = 0.19f; scale.z = 0.03f; } if (this.transform.localPosition.y < -1.0) { this.Remove(); ImageUIObjectsManager.SetLeft(this.gameObject); } this.transform.localScale += (scale - this.transform.localScale) * dt * 10.0f; }
//Get Datas from Native void ImagesLoad(string count) { totalImageCount = System.Int32.Parse(count); ImageUIObjectsManager.Setup(totalImageCount); }