//----------------------------------------------------- void Start() { //if((PC.DEBUG && DEBUG) || PC.DEBUGALL) Debug.Log(DEBUGTAG+"Start"); if(m_mainScene == null) Debug.LogError(DEBUGTAG+"MainScene"+ PC.MISSING_REF); if(m_mainNode == null) Debug.LogError(DEBUGTAG+"MainNode"+ PC.MISSING_REF); if(m_avatar == null) Debug.LogError(DEBUGTAG+"Avatar"+ PC.MISSING_REF); if(m_bgCam == null) Debug.LogError(DEBUGTAG+"Background camera"+PC.MISSING_REF); if(m_toggleSkin == null) Debug.LogError(DEBUGTAG+"MainScene"+ PC.MISSING_REF); if(m_maskCam == null) Debug.LogError(DEBUGTAG+"MaskCam"+ PC.MISSING_REF); if(m_backgroundImg == null) Debug.LogError(DEBUGTAG+"Background image"+ PC.MISSING_REF); if(m_beforeAfter == null) Debug.LogError(DEBUGTAG+"Before after"+ PC.MISSING_REF); if(m_backGrid == null) Debug.LogError(DEBUGTAG+"Back Grid"+ PC.MISSING_REF); if(m_mode2DTiledGrid == null) Debug.LogError(DEBUGTAG+"Mode2D Tiled grid"+PC.MISSING_REF); if(m_eraserImages == null) Debug.LogError(DEBUGTAG+"EraserImages"+ PC.MISSING_REF); if(m_grassImages == null) Debug.LogError(DEBUGTAG+"GrassImages"+ PC.MISSING_REF); if(m_lineMgr == null) Debug.LogError(DEBUGTAG+"LineMananger"+ PC.MISSING_REF); if(m_helpBgTex == null) Debug.LogError(DEBUGTAG+"Help Bg Tex"+ PC.MISSING_REF); // -- Chargement auto des images d'aide, selon plateforme -- string path = ""; if(UnityEngine.Application.platform == RuntimePlatform.Android || UnityEngine.Application.platform == RuntimePlatform.IPhonePlayer) path = "images_multilangue/"+PlayerPrefs.GetString("language")+"/"+m_helpTexTouchPath+"/"; // Aide Touchpad else path = "images_multilangue/"+PlayerPrefs.GetString("language")+"/"+m_helpTexMousePath+"/"; // Aide Souris m_helpTexObj = (Texture2D) Resources.Load(path+m_helpTexObjFile, typeof(Texture2D)); if(m_helpTexObj == null) Debug.LogError( DEBUGTAG+path+m_helpTexObjFile+" "+ PC.MISSING_RES); m_helpTexLin = (Texture2D) Resources.Load(path+m_helpTexLinFile, typeof(Texture2D)); if(m_helpTexLin == null) Debug.LogError(DEBUGTAG+path+m_helpTexLinFile+" "+ PC.MISSING_RES); // -- Initialisations -- m_maskCreator = (MaskCreator) m_maskCam.GetComponent<MaskCreator>(); m_mainCam = GetComponent<Camera>(); m_movingObj = false; m_invalidateClick = false; m_zoomImage = 1f; m_orgBgImgPixIn = new Rect(); m_oldScreenSize = new Vector2(); m_savedBgImgPixIn = new Rect(); // -- Scale list -- m_scaleList = new int[]{200, 500, 650}; m_curScaleID = 0; m_rescaleFactor = 1f; m_zoomObjects = m_scaleList[0]*m_rescaleFactor*(m_modePortrait ? c_scaleZoomFactorPortrait : c_scaleZoomFactor); m_rotationObjects = 0f; m_locationObjects = Vector3.zero; m_measuring = false; m_iPadPath = ""; m_loadedBg = null; m_newBgImgLoaded = false; m_bkupAngle = new Quaternion(); m_bkupPivot = transform.parent.transform; m_bkupPos = new Vector3(); m_bkupRenderZone = new Rect(); m_bkupAvatarEnabled = false; m_bkupSelected = null; m_bkupBgImgColor = new Color(); m_bkupCullingMask = m_mainCam.cullingMask; m_m2dObjs = new List<Transform>(); m_bkupObjScl = new List<Vector3>(); m_bkupObjPos = new List<Vector3>(); m_bkupObjRot = new List<Quaternion>(); // m_objectsToHide = new List<GameObject>(); m_hideUI = false; GUIStyle style = m_toggleSkin.GetStyle("toggle_2d3d"); m_toggleRect = new Rect(0, 0, style.fixedHeight, style.fixedWidth); float sw = Screen.width; float sh = Screen.height; // -- Load panel -- m_loadPanelFromRightMenu = false; m_showLoadPanel = false; m_loadPanelRect = new Rect((sw-250f)/2f, (sh-350f)/2f, 250f, 320f); m_lpLabel1Rect = new Rect( 20f, 20f, 210f, 40f); m_lpBtnLoadRect = new Rect( 20f, 60f, 210f, 50f); m_lpTextRect = new Rect( 20f, 110f, 210f, 20f); m_lpLabel2Rect = new Rect( 20f, 140f, 210f, 40f); m_lpBtnScl1Rect = new Rect( 20f, 180f, 70f, 30f); m_lpBtnScl2Rect = new Rect( 90f, 180f, 70f, 30f); m_lpBtnScl3Rect = new Rect(160f, 180f, 70f, 30f); m_lpBtnOKrect = new Rect( 20f, 250f, 105f, 40f); m_lpBtnCancelrect = new Rect(125f, 250f, 105f, 40f); // -- Right menu -- int menuW = 175; m_showRightMenu = false; m_rBgTopRect = new Rect(menuW, 0f, -menuW, 150f); // Menu de droite m_rTitleRect = new Rect( 0f, 100f, menuW, 50f); m_rBtn1TxtRect = new Rect( 0f, 150f, menuW, 50f); m_rBtn1Rect = new Rect( 0f, 150f, menuW, 50f); m_rBtnTxtRectPlanManipulation = new Rect( 0f, 200f, menuW, 50f); m_rBtnRectPlanManipulation = new Rect( 50f, 200f, menuW, 50f); m_rBtnRectResetPlan = new Rect( 0f, 250f, menuW, 50f); m_rBtnTxtRectResetPlan = new Rect( 0f, 250f, menuW, 50f); m_rBtnRectDelete = new Rect( 0f, 300f, menuW, 50f); m_rBtnTxtRectDelete = new Rect( 0f, 300f, menuW, 50f); m_rObjectRect = new Rect( 0f, 350f, menuW, 50f); m_rBtnTxtRectObjectsManipulation = new Rect( 0f, 400f, menuW, 50f); m_rBtnRectObjectsManipulation = new Rect( 50f, 400f, menuW, 50f); m_rBtnTxtRectRecenter = new Rect( 0f, 450f, menuW, 50f); m_rBtnRectRecenter = new Rect( 0, 450f, menuW, 50f); m_rBtn4TxtRect = new Rect( 0f, 500f, menuW, 50f); m_rBtn4Rect = new Rect( 0f, 500f, menuW, 50f); m_rImageRect = new Rect( 0f, 500f, menuW, 50f); m_rBtn2TxtRect = new Rect( 0f, 550f, menuW, 50f); m_rBtn2Rect = new Rect( 0f, 550f, menuW, 50f); m_rBtn3Rect = new Rect( 0f, 600f, menuW, 50f); m_rBtn3TxtRect = new Rect( 0f, 600f, menuW, 50f); //m_validTexture=(Texture)Resources.Load("gui/check"); #if UNITY_IPHONE || UNITY_ANDROID m_rBtn5Rect = new Rect( 0f, 700f, menuW, 50f); m_rBtn5TxtRect = new Rect( 0f, 700f, menuW, 50f); m_rBgMidRect = new Rect( menuW, 150f, -menuW, 550f); m_rBgBotRect = new Rect( menuW, 700f, -menuW, 150f); m_rGroupRect = new Rect( 0f, 0f, menuW, 800f); #else m_rBgMidRect = new Rect( menuW, 150f, -menuW, 500f); m_rBgBotRect = new Rect( menuW, 650f, -menuW, 150f); m_rGroupRect = new Rect( 0f, 0f, 174, Screen.height); #endif // -- Rects UI -- m_uiRects = new Rect[2]; for(int i=0; i<m_uiRects.Length; i++) m_uiRects[i] = new Rect(0f, 0f, 0f, 0f); // -- Warning -- m_warningRect = new Rect(0f, Screen.height*0.8f, Screen.width, 30f); m_showWarning = false; m_warningTxt = ""; m_warningFading = false; m_warningFadeTimer = 0f; m_warningFadeStartCol = Color.clear; m_warningFadeEndCol = Color.clear; // -- Help -- m_curHelpTex = null; m_nextHelpTex = null; m_helpRect = new Rect(); m_helpTimer = 0f; m_displayHelp = false; m_animHelp = false; m_animHelpProg = 0f; m_helpGUIalpha = 0f; m_helpGUIaStart = 0f; m_helpGUIaEnd = 0f; m_helpCountdown = false; m_resizeEnabled = false; m_modePortrait = false; ResizeRectsToScreen(); m_sceneModel = Montage.sm; }
// Use this for initialization void Start() { if(usefullData.lowTechnologie) { _cameraFrustrum = GameObject.Find("mainCam").GetComponent<CameraFrustum>(); Mesh mesh = GetComponent<MeshFilter> ().mesh; Vector3[] vertices = mesh.vertices; Vector2[] uvs = new Vector2[vertices.Length]; int i = 0; while (i < uvs.Length) { uvs[i] = new Vector2 (vertices[i].x, vertices[i].z); //Debug.Log("mask Start : "+uvs[i]); i++; } mesh.uv = uvs; if(textureApply!=null) { textureApply.wrapMode = TextureWrapMode.Repeat; GetComponent<Renderer>().material.SetTexture ("_MainTex", textureApply); _guiText = GameObject.Find ("backgroundImage").GetComponent<GUITexture>(); } mc = GameObject.Find("maskCam").GetComponent<MaskCreator>(); } else { string originalShaderName = transform.GetComponent<Renderer>().material.shader.name; if (originalShaderName.Contains("inverse")) { Shader shad = (Shader)Resources.Load("shaders/"+"Pointcube_maskInverse"); transform.GetComponent<Renderer>().material.shader = shad; } else { Shader shad = (Shader)Resources.Load("shaders/"+"Pointcube_mask"); transform.GetComponent<Renderer>().material.shader = shad; } } }