public void initShareToFacebook() { shareStatus = FacebookManager.ShareStatus.Init; camDisplayCanvas.SetActive(false); uiCanvas.SetActive(false); shareCanvas.SetActive(true); }
// Init all the game states void initLevel() { // Init Cnavas gameCanvas.SetActive(true); winCanvas.SetActive(false); shareSucceedCanvas.SetActive(false); findEggCanvas.SetActive(false); editEggNameCanvas.SetActive(false); Debug.Log("Canvas finished"); // Init Reward score = 0; eggIndex = -1; eggName = ""; Debug.Log("REward f"); // Init Game States buildingDestroyedCount = 0; win = false; shareStatus = FacebookManager.ShareStatus.None; fallenPiecesCount = 0; // Shake Action shakeDetectionThreshold *= shakeDetectionThreshold; lowPassValue = Input.acceleration; Debug.Log("Shake f "); // To Be Used GameObjects shakeText = gameCanvas.transform.FindChild("ShakeText").gameObject; shakeText.SetActive(false); ground = GameObject.FindGameObjectWithTag("ground"); progressBar = gameCanvas.transform.FindChild("FullImage").gameObject; Debug.Log("Progress finished"); GetComponent <SpriteControl> ().deactivateColor(); MainMenuScript mainMenu = mainController.GetComponent <MainMenuScript> (); kaiju = GameObject.Find("Kaiju").gameObject; selectedKaiju = mainMenu.SelectedKaiju; if (selectedKaiju != null) { kaiju.GetComponent <MonsterCreator> (). setUpMonster(selectedKaiju.HeadType, selectedKaiju.HandType, selectedKaiju.BodyType, selectedKaiju.MonsterColor); } else { kaiju.GetComponent <MonsterCreator> (). setUpMonster(6, 1, 1, Color.white); } Debug.Log("Setup Kaiju"); StartCoroutine(closeDestroyText(2.0f)); }
void SendScreenshotToFacebook() { shareStatus = FacebookManager.ShareStatus.Sending; Debug.Log(screenShotCopy); Texture2D screenShotShareCopy = new Texture2D(screenShotCopy.width, screenShotCopy.height); Color32[] pix = screenShotCopy.GetPixels32(); screenShotShareCopy.SetPixels32(pix); screenShotShareCopy.Apply(); FacebookManager.single.ShareImageToFacebook(screenShotShareCopy); }
/********************************** * * Update * * ********************************/ void OnGUI() { switch (shareStatus) { case FacebookManager.ShareStatus.Init: { SendScreenshotToFacebook(); return; } case FacebookManager.ShareStatus.Sending: return; case FacebookManager.ShareStatus.Recieved: { shareStatus = FacebookManager.ShareStatus.None; // Should show a dialog to show status shareSucceedCanvas.SetActive(true); return; } default: break; } if (!win) { progressBar.transform.localScale = new Vector3(0.53f * ((float)(progressCount [level]) / (totalProgress)), 0.53f, 0.53f); } else { if (findEggCanvas.activeSelf) { return; } // TODO: Change this back if (winCanvas && (winCoroutineEnded.Success == true)) { //if (winCanvas) { GameObject scoreText = winCanvas.transform.FindChild("ScoreText").gameObject; scoreText.GetComponent <Text> ().text = "x " + score.ToString(); winCanvas.SetActive(true); } } }
// Use this for initialization void Start() { //initCamera (CameraMode.EggCheckin); shareStatus = FacebookManager.ShareStatus.None; }
void Update() { if (!pCamera) { return; } if (pCamera.width < 100 && !CAMREADY) { return; } else { // Means getting image if (!CAMREADY) { Debug.Log("Initializing Camera"); double ratio = (float)pCamera.width / (float)pCamera.height; double screenRatio = (double)Screen.height / (double)Screen.width; //camDisplayPlane.transform.localScale += new Vector3 (0.0f, 0.0f, (float)(ratio-1.0)); GameObject cameraImage = camDisplayCanvas.transform.FindChild("CameraImage").gameObject; if (Application.platform == RuntimePlatform.Android) { cameraImage.transform.rotation = Quaternion.Euler(0, 0, 90); } if (screenRatio < ratio) { camDisplayCanvas.GetComponent <CanvasScaler> ().referenceResolution = new Vector2(Screen.width, Screen.height); cameraImage.GetComponent <RectTransform> (). SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, (float)(Screen.width * ratio)); cameraImage.GetComponent <RectTransform> (). SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(Screen.width)); } else { camDisplayCanvas.GetComponent <CanvasScaler> ().referenceResolution = new Vector2(Screen.width, Screen.height); cameraImage.GetComponent <RectTransform> (). SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, (float)(Screen.height)); cameraImage.GetComponent <RectTransform> (). SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(Screen.height / ratio)); } CAMREADY = true; camDisplayCanvas.SetActive(true); uiCanvas.SetActive(true); } if (takingPhoto) { // should just do it once takePhoto(); return; } } switch (shareStatus) { case FacebookManager.ShareStatus.Init: { SendScreenshotToFacebook(); return; } case FacebookManager.ShareStatus.Sending: return; case FacebookManager.ShareStatus.Recieved: { shareStatus = FacebookManager.ShareStatus.None; // Should show a dialog to show status shareCanvas.SetActive(true); shareCanvas.transform.Find("ShareSucceedText").gameObject.SetActive(true); return; } default: break; } }
void SendScreenshotToFacebook() { shareStatus = FacebookManager.ShareStatus.Sending; FacebookManager.single.ShareScreenshotToFacebook(); }
public void initShareToFacebook() { shareStatus = FacebookManager.ShareStatus.Init; winCanvas.SetActive(false); gameCanvas.SetActive(false); }