//----------------------------------------------------- void Awake() { m_bgImgMgr = m_backgroundImg.GetComponent<BgImgManager>(); if(m_bgImgMgr == null) Debug.LogError(DTAG+"BgImgManager"+PC.MISSING_REF); if(m_mode2D == null) Debug.LogError(DTAG+"Mode2D" +PC.MISSING_REF); if(m_mainCam == null) Debug.LogError(DTAG+"MainCam" +PC.MISSING_REF); if(m_lineTex == null) Debug.LogError(DTAG+"Line texture"+PC.MISSING_REF); m_vertexTex = (Texture2D) Resources.Load("tracage/OS_DOT_ADD"); m_vertexTex_Sub = (Texture2D) Resources.Load("tracage/OS_DOT_SUB"); m_tmpLineTex = (Texture2D) Resources.Load("tracage/OS_TRACE_ADD"); m_tmpLineTex_Sub = (Texture2D) Resources.Load("tracage/OS_TRACE_SUB"); GameObject GUITexLoupe = GameObject.Find("Background/loupe/GUITexLoupe"); _loupeGUI = GUITexLoupe.GetComponent<LoupeGUI>(); m_ignoreClick = true; m_opengl = SystemInfo.graphicsDeviceVersion.Contains("OpenGL"); m_lines = new List<Line>(); m_lineStarted = false; m_tmpLine = null; m_selectedLine = null; m_loupeActive = false; m_loupeClickTime = 0; m_loupeTex = new Texture2D(64, 64, TextureFormat.RGB24, false); m_loupeGUI = GUITexLoupe.GetComponent<GUITexture>(); m_loupeRenderTex = null; m_loupeGUI.texture = m_loupeTex; m_aaBkup = QualitySettings.antiAliasing; m_outlineStyle = new GUIStyle(m_textStyle); m_outlineStyle.normal.textColor = m_textOutlineColor; this.enabled = false; }
//----------------------------------------------------- void Start() { GameObject GUITexLoupe = GameObject.Find("Background/loupe/GUITexLoupe"); _loupeGUI = GUITexLoupe.GetComponent<LoupeGUI>(); if(_loupeGUI!=null) _loupeGUI.SetInvert(m_invert); _GUIMenuMain = GameObject.Find("MainScene").GetComponent<GUIMenuMain>(); base.StartMouseTool(); if(m_grassNode == null) Debug.LogError(DEBUGTAG+"Grass Node" +PC.MISSING_REF); if(m_eraserNode == null) Debug.LogError(DEBUGTAG+"Eraser Node"+PC.MISSING_REF); if(m_mainCam == null) Debug.LogError(DEBUGTAG+"Main Camera"+PC.MISSING_REF); if(m_mainScene == null) Debug.LogError(DEBUGTAG+"Main Scene" +PC.MISSING_REF); if(m_style == null) Debug.LogError(DEBUGTAG+"GUI style " +PC.MISSING_REF); m_pleaseWaitUI = m_mainScene.GetComponent<PleaseWaitUI>(); if(m_pleaseWaitUI == null) Debug.LogError("Script PleaseWaitUI non trouve"); //m_guiZones = new List<Rect>(); // initialisation dans AddGuiZone() car Start est appelé après // m_cancelButtonRect = // de même pour m_cancelButtonRect m_lastClickTime = 0; m_clicked = false; m_loupeActive = false; m_loupeClickTime = 0; m_loupeTex = new Texture2D(64, 64, TextureFormat.RGB24, false); m_loupeGUI = GUITexLoupe.GetComponent<GUITexture>(); m_loupeRenderTex = null; m_loupeGUI.texture = m_loupeTex; // m_loupeCam.targetTexture = m_loupeRenderTex; m_stickBd = 16; // m_stickX = -1; // m_stickY = -1; // Outil à appeler après le remplissage du polygone, et éventuels paramètres m_tool = (m_tool == GUIEditTools.EditTool.None)? GUIEditTools.EditTool.Eraser : m_tool; // On utilise la gomme par défaut // -- GUI -- m_cancelRect = new Rect(0f, 0f, m_style.fixedWidth, m_style.fixedHeight); SetGUIrects(); // AddGuiZone(m_cancelRect); m_mainCam.GetComponent<Mode2D>().enabled = false; m_mainScene.GetComponent<HelpPanel>().enabled = false; }