コード例 #1
0
    private static int Broadcast(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string funcName = ToLua.ToString(L, 1);
                NGUITools.Broadcast(funcName);
                result = 0;
            }
            else if (num == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(object)))
            {
                string funcName2 = ToLua.ToString(L, 1);
                object param     = ToLua.ToVarObject(L, 2);
                NGUITools.Broadcast(funcName2, param);
                result = 0;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: NGUITools.Broadcast");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
コード例 #2
0
    static int Broadcast(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string arg0 = ToLua.ToString(L, 1);
                NGUITools.Broadcast(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(object)))
            {
                string arg0 = ToLua.ToString(L, 1);
                object arg1 = ToLua.ToVarObject(L, 2);
                NGUITools.Broadcast(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: NGUITools.Broadcast"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #3
0
 static public int Broadcast_s(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             System.String a1;
             checkType(l, 1, out a1);
             NGUITools.Broadcast(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             System.String a1;
             checkType(l, 1, out a1);
             System.Object a2;
             checkType(l, 2, out a2);
             NGUITools.Broadcast(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #4
0
ファイル: Lua_NGUITools.cs プロジェクト: wizcas/hugula
 static public int Broadcast_s(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             System.String a1;
             checkType(l, 1, out a1);
             NGUITools.Broadcast(a1);
             return(0);
         }
         else if (argc == 2)
         {
             System.String a1;
             checkType(l, 1, out a1);
             System.Object a2;
             checkType(l, 2, out a2);
             NGUITools.Broadcast(a1, a2);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #5
0
    /// <summary>
    /// Load the specified asset and activate the localization.
    /// </summary>

    void Load(TextAsset asset)
    {
        mLanguage = asset.name;
        PlayerPrefs.SetString("Language", mLanguage);
        ByteReader reader = new ByteReader(asset);

        mDictionary = reader.ReadDictionary();
        NGUITools.Broadcast("OnLocalize", this);
    }
コード例 #6
0
ファイル: UILoadScene.cs プロジェクト: mkelany/HayDay-Project
        private IEnumerator Load(string levelName)
        {
            yield return(new WaitForSeconds(0.7f));

            if (!string.IsNullOrEmpty(levelName))
            {
                if (levelName.Equals("Quit"))
                {
                    Application.Quit();
                }
                else if (levelName.Equals("Farm"))
                {
                    if (loadPlayer)
                    {
                        bool fileTest1 = File.Exists(Application.persistentDataPath + "/player.dat");
                        bool fileTest2 = File.Exists(Application.persistentDataPath + "/cows.dat");

                        if (fileTest1 || fileTest2)
                        {
                            GameController.Instance().loadPlayer = true;
                            UIBackground.BackgroundDark(true);
                            UIBackground.LoadingTexture(true);
                            UIBackground.Background(false);
                            UIBackground.Logo(false);
                            UIBackground.LoadingTexture(true);
                            StartCoroutine(DelayLoadScene(1, levelName));
                        }
                        else
                        {
                            StartCoroutine(DelayReset(2));
                            UIBackground.Logo(false);
                            UIBackground.BackgroundDark(true);
                            UIBackground.NogameTexture(true);
                            UIBackground.Background(false);
                        }
                    }
                    else
                    {
                        if (newGame)
                        {
                            GameController.Instance().newGame = true;
                            UIBackground.BackgroundDark(true);
                            UIBackground.LoadingTexture(true);
                            UIBackground.Background(false);
                            UIBackground.NameLabel(false);
                            UIBackground.InputField(false);
                            StartCoroutine(DelayLoadScene(1, levelName));
                        }
                    }
                }
                else
                {
                    NGUITools.Broadcast("End");
                    Application.LoadLevel(levelName);
                }
            }
        }
コード例 #7
0
 private void ResizeEverything()
 {
     if (debugMode)
     {
         label.text = "Height: " + height + " PixRtio: " + mainAtlas.pixelSize;
     }
     NGUITools.Broadcast("MakePixelPerfect");
     NGUITools.Broadcast("ResizeButton");
     NGUITools.Broadcast("ResizeLabel");
     //NGUITools.Broadcast("ResetRoot", height);
 }
コード例 #8
0
    IEnumerator fixPixelPerfect()
    {
        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        NGUITools.Broadcast("MakePixelPerfect");

        yield return(null);
    }
コード例 #9
0
 private void BuildFinished()
 {
     // Value가 1인이 확인한다
     slider.value = 1;
     // key를 완성된 상태인 Barrier로 바꾸고 UILocalize 컴포넌트를 갱신한다
     loc.key = "Barrier";
     //GetComponentInChildren<UILabel>().text = loc.key;
     NGUITools.Broadcast("OnLocalize", this);
     // 장애물이 완성되면 built 변수를 참으로 하고 충돌체를 활성화한다
     built = true;
     GetComponent <Collider>().enabled = true;
 }
コード例 #10
0
 static public int Broadcast_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             System.String a1;
             checkType(l, 1, out a1);
             NGUITools.Broadcast(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             System.String a1;
             checkType(l, 1, out a1);
             System.Object a2;
             checkType(l, 2, out a2);
             NGUITools.Broadcast(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function Broadcast to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #11
0
    private static int Broadcast(IntPtr L)
    {
        int num = LuaDLL.lua_gettop(L);

        if (num == 1)
        {
            string luaString = LuaScriptMgr.GetLuaString(L, 1);
            NGUITools.Broadcast(luaString);
            return(0);
        }
        if (num == 2)
        {
            string luaString2 = LuaScriptMgr.GetLuaString(L, 1);
            object varObject  = LuaScriptMgr.GetVarObject(L, 2);
            NGUITools.Broadcast(luaString2, varObject);
            return(0);
        }
        LuaDLL.luaL_error(L, "invalid arguments to method: NGUITools.Broadcast");
        return(0);
    }
コード例 #12
0
    void fixAll()
    {
        if (activeDeviceIdx == -1)
        {
            return;
        }

        if (activeScreenIdx == -1)
        {
            return;
        }

        fixRoot();
        fixAtlases();
        fixFonts();

        Resources.UnloadUnusedAssets();
        NGUITools.Broadcast("MakePixelPerfect");
        StartCoroutine(fixPixelPerfect());
    }
コード例 #13
0
ファイル: NGUIToolsWrap.cs プロジェクト: linml/Assets
    static int Broadcast(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            string arg0 = LuaScriptMgr.GetLuaString(L, 1);
            NGUITools.Broadcast(arg0);
            return(0);
        }
        else if (count == 2)
        {
            string arg0 = LuaScriptMgr.GetLuaString(L, 1);
            object arg1 = LuaScriptMgr.GetVarObject(L, 2);
            NGUITools.Broadcast(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: NGUITools.Broadcast");
        }

        return(0);
    }
コード例 #14
0
    void StartScreen(string screen)
    {
        switch (screen)
        {
        case "Menu":
            menuOpened     = true;
            gameOpened     = false;
            helpOpened     = false;
            exitOpened     = false;
            endOpened      = false;
            levelWinOpened = false;
            if (!menuAnchor.activeInHierarchy)
            {
                menuAnchor.SetActive(true);
            }
            if (gameAnchor.activeInHierarchy)
            {
                gameAnchor.SetActive(false);
            }
            if (helpAnchor.activeInHierarchy)
            {
                helpAnchor.SetActive(false);
            }
            if (exitAnchor.activeInHierarchy)
            {
                exitAnchor.SetActive(false);
            }
            if (endAnchor.activeInHierarchy)
            {
                endAnchor.SetActive(false);
            }
            if (levelWinAnchor.activeInHierarchy)
            {
                levelWinAnchor.SetActive(false);
            }
            break;

        case "Game":
            menuOpened     = false;
            gameOpened     = true;
            helpOpened     = false;
            exitOpened     = false;
            endOpened      = false;
            levelWinOpened = false;
            if (menuAnchor.activeInHierarchy)
            {
                menuAnchor.SetActive(false);
            }
            if (!gameAnchor.activeInHierarchy)
            {
                gameAnchor.SetActive(true);
            }
            if (helpAnchor.activeInHierarchy)
            {
                helpAnchor.SetActive(false);
            }
            if (exitAnchor.activeInHierarchy)
            {
                exitAnchor.SetActive(false);
            }
            if (endAnchor.activeInHierarchy)
            {
                endAnchor.SetActive(false);
            }
            if (levelWinAnchor.activeInHierarchy)
            {
                levelWinAnchor.SetActive(false);
            }
            break;

        case "Help":
            menuOpened     = false;
            gameOpened     = false;
            helpOpened     = true;
            exitOpened     = false;
            endOpened      = false;
            levelWinOpened = false;
            if (menuAnchor.activeInHierarchy)
            {
                menuAnchor.SetActive(false);
            }
            if (gameAnchor.activeInHierarchy)
            {
                gameAnchor.SetActive(false);
            }
            if (!helpAnchor.activeInHierarchy)
            {
                helpAnchor.SetActive(true);
            }
            if (exitAnchor.activeInHierarchy)
            {
                exitAnchor.SetActive(false);
            }
            if (endAnchor.activeInHierarchy)
            {
                endAnchor.SetActive(false);
            }
            if (levelWinAnchor.activeInHierarchy)
            {
                levelWinAnchor.SetActive(false);
            }
            break;

        case "Exit":
            menuOpened     = false;
            gameOpened     = false;
            helpOpened     = false;
            exitOpened     = true;
            endOpened      = false;
            levelWinOpened = false;
            if (menuAnchor.activeInHierarchy)
            {
                menuAnchor.SetActive(false);
            }
            if (gameAnchor.activeInHierarchy)
            {
                gameAnchor.SetActive(false);
            }
            if (helpAnchor.activeInHierarchy)
            {
                helpAnchor.SetActive(false);
            }
            if (!exitAnchor.activeInHierarchy)
            {
                exitAnchor.SetActive(true);
            }
            if (endAnchor.activeInHierarchy)
            {
                endAnchor.SetActive(false);
            }
            if (levelWinAnchor.activeInHierarchy)
            {
                levelWinAnchor.SetActive(false);
            }
            break;

        case "End":
            menuOpened     = false;
            gameOpened     = false;
            helpOpened     = false;
            exitOpened     = false;
            endOpened      = true;
            levelWinOpened = false;
            if (menuAnchor.activeInHierarchy)
            {
                menuAnchor.SetActive(false);
            }
            if (gameAnchor.activeInHierarchy)
            {
                gameAnchor.SetActive(false);
            }
            if (helpAnchor.activeInHierarchy)
            {
                helpAnchor.SetActive(false);
            }
            if (exitAnchor.activeInHierarchy)
            {
                exitAnchor.SetActive(false);
            }
            if (!endAnchor.activeInHierarchy)
            {
                endAnchor.SetActive(true);
            }
            if (levelWinAnchor.activeInHierarchy)
            {
                levelWinAnchor.SetActive(false);
            }
            break;

        case "LevelWin":
            menuOpened     = false;
            gameOpened     = false;
            helpOpened     = false;
            exitOpened     = false;
            endOpened      = false;
            levelWinOpened = true;
            if (menuAnchor.activeInHierarchy)
            {
                menuAnchor.SetActive(false);
            }
            if (gameAnchor.activeInHierarchy)
            {
                gameAnchor.SetActive(false);
            }
            if (helpAnchor.activeInHierarchy)
            {
                helpAnchor.SetActive(false);
            }
            if (exitAnchor.activeInHierarchy)
            {
                exitAnchor.SetActive(false);
            }
            if (endAnchor.activeInHierarchy)
            {
                endAnchor.SetActive(false);
            }
            if (!levelWinAnchor.activeInHierarchy)
            {
                levelWinAnchor.SetActive(true);
            }
            break;
        }

        NGUITools.Broadcast("MakePixelPerfect");
        NGUITools.Broadcast("ResizeButton");
        NGUITools.Broadcast("ResizeLabel");
    }
コード例 #15
0
ファイル: retinaProNGTools.cs プロジェクト: chrismcmath/Paint
 static void pixPerfect2()
 {
     NGUITools.Broadcast("MakePixelPerfect");
 }
コード例 #16
0
    /// <summary>
    /// Selection event, sent by UICamera.
    /// </summary>

    void OnSelect(bool isSelected)
    {
        if (label != null && enabled && gameObject.activeSelf)
        {
            if (isSelected)
            {
                mText       = (label.text == mDefaultText) ? "" : label.text;
                label.color = activeColor;

#if UNITY_IPHONE || UNITY_ANDROID
                if (Application.platform == RuntimePlatform.IPhonePlayer ||
                    Application.platform == RuntimePlatform.Android)
                {
#if UNITY_3_4
                    mKeyboard = iPhoneKeyboard.Open(mText);
#else
                    mKeyboard = TouchScreenKeyboard.Open(mText);
#endif
                    UpdateLabel();
                }
                else
#endif
                {
                    Input.imeCompositionMode = IMECompositionMode.On;
                    Transform t      = label.cachedTransform;
                    Vector3   offset = label.pivotOffset;
                    offset.y += label.relativeSize.y;
                    offset    = t.TransformPoint(offset);
                    Input.compositionCursorPos = UICamera.lastCamera.WorldToScreenPoint(offset);
                    UpdateLabel();
                }

                NGUITools.Broadcast(UIInput.OnInputGotFocus, label);

                InvokeRepeating("FlashCarat", 0, 0.5f);
            }
#if UNITY_IPHONE || UNITY_ANDROID
            else if (mKeyboard != null)
            {
                mKeyboard.active = false;

                if (string.IsNullOrEmpty(mText))
                {
                    label.text  = mDefaultText;
                    label.color = mDefaultColor;
                }
                else
                {
                    label.text = mText;
                }

                label.showLastPasswordChar = false;
                CancelInvoke("FlashCarat");

                NGUITools.Broadcast(UIInput.OnInputLostFocus, label);
            }
#endif
            else
            {
                if (string.IsNullOrEmpty(mText))
                {
                    label.text  = mDefaultText;
                    label.color = mDefaultColor;
                }
                else
                {
                    label.text = mText;
                }

                label.showLastPasswordChar = false;
                Input.imeCompositionMode   = IMECompositionMode.Off;
                CancelInvoke("FlashCarat");

                NGUITools.Broadcast(UIInput.OnInputLostFocus, label);
            }
        }
    }
コード例 #17
0
 public static void ResetRoot()
 {
     NGUITools.Broadcast("ResetRoot", height);
 }