Example #1
0
    static int FindChild(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Transform), typeof(string)))
            {
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1);
                string arg1             = ToLua.ToString(L, 2);
                UnityEngine.Transform o = GameObjectExtension.FindChild(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Transform), typeof(string[])))
            {
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1);
                string[] arg1           = ToLua.CheckStringArray(L, 2);
                UnityEngine.Transform o = GameObjectExtension.FindChild(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: GameObjectExtension.FindChild"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
    public GameObject FindWidget(string objName)
    {
        string[] name_path = objName.Split('/');

        Transform tf = GameObjectExtension.FindChild(m_wndObj.transform, name_path);

        return((tf == null) ? null : tf.gameObject);
    }
Example #3
0
    //弹出一个消息
    public void PopMsg(string msg, Color color)
    {
        float minY = m_StartY + (float)m_PopingObjs.Count * m_ItemHeight;

        if (IsSameItem(msg))
        {
            return;
        }

        //将一些过矮的元素提升
        foreach (TipItem curr in m_PopingObjs)
        {
            GameObject obj = curr.obj;
            if (obj.transform.localPosition.y < minY)
            {
                Vector3 pos = obj.transform.localPosition;
                pos.y = minY;
                obj.transform.localPosition = pos;
            }

            minY -= m_ItemHeight;
        }

        //创建item对象
        GameObject item = GameObjectExtension.InstantiateFromPreobj(m_ItemMB, m_ItemMB.transform.parent.gameObject);

        item.SetActive(true);
        NGUITools.MarkParentAsChanged(item);

        TipItem newItem = new TipItem()
        {
            lostTime = 0, obj = item
        };

        m_PopingObjs.Add(newItem);

        //设置标签
        string[] findpath = new string[1];
        findpath[0] = "Label";

        GameObject lableObj = GameObjectExtension.FindChild(item.transform, findpath).gameObject;
        UILabel    cmlabel  = lableObj.GetComponent <UILabel>();

        cmlabel.text  = msg;
        cmlabel.color = color;

        //解除位置绑定关系
        UIRect cm_rect = item.GetComponent <UIRect>();

        cm_rect.SetAnchor((GameObject)null);

        if (!m_CoroutineIsDoing)
        {
            CoroutineManage.Single.StartCoroutine(coUpdate());
        }
    }
Example #4
0
            public CRealAuthenticate(GameObject obj)
            {
                mUIObject = obj;

                mReturn   = GameObjectExtension.FindChild(obj.transform, "back_btn").gameObject;
                mCardTab  = new CCardTab(GameObjectExtension.FindChild(obj.transform, "idcard_page").gameObject);
                mPhoneTab = new CPhoneTab(GameObjectExtension.FindChild(obj.transform, "mobileregister_page").gameObject);

                UIEventListener.Get(mReturn).onClick += OnBack;
            }
Example #5
0
            public CBindUI(GameObject obj)
            {
                mUIObject = obj;

                mAccount    = GameObjectExtension.FindChild(obj.transform, "id/txt").gameObject.GetComponent <UIInput>();
                mPassword   = GameObjectExtension.FindChild(obj.transform, "key/txt").gameObject.GetComponent <UIInput>();
                mRePassword = GameObjectExtension.FindChild(obj.transform, "key_define/txt").gameObject.GetComponent <UIInput>();
                mCloseBtn   = GameObjectExtension.FindChild(obj.transform, "close_btn").gameObject;
                mRegBtn     = GameObjectExtension.FindChild(obj.transform, "register_btn").gameObject;

                UIEventListener.Get(mCloseBtn).onClick += OnClose;
            }
Example #6
0
            public CLoginEntry(GameObject obj)
            {
                mUIObject = obj;

                mQuickLogin   = GameObjectExtension.FindChild(obj.transform, "quicklogin_btn").gameObject;
                mAccountLogin = GameObjectExtension.FindChild(obj.transform, "idlogin_btn").gameObject;
                mRegAccount   = GameObjectExtension.FindChild(obj.transform, "idregister_btn").gameObject;

                UIEventListener.Get(mQuickLogin).onClick   = OnQuickLogin;
                UIEventListener.Get(mRegAccount).onClick   = OnRegAccount;
                UIEventListener.Get(mAccountLogin).onClick = OnAccountLogin;
            }
Example #7
0
            public CRegistLogin(GameObject obj)
            {
                mUIObject = obj;

                mAccount      = GameObjectExtension.FindChild(obj.transform, "id/txt").gameObject.GetComponent <UIInput>();
                mPassword     = GameObjectExtension.FindChild(obj.transform, "key/txt").gameObject.GetComponent <UIInput>();
                mRePassword   = GameObjectExtension.FindChild(obj.transform, "key_define/txt").gameObject.GetComponent <UIInput>();
                mReturnBtn    = GameObjectExtension.FindChild(obj.transform, "back_btn").gameObject;
                mHeadPortrait = GameObjectExtension.FindChild(obj.transform, "headportrait").gameObject;
                mRegBtn       = GameObjectExtension.FindChild(obj.transform, "register_btn").gameObject;

                UIEventListener.Get(mReturnBtn).onClick += OnBack;
                UIEventListener.Get(mRegBtn).onClick    += OnRegClick;
            }
Example #8
0
            public CLoginUI(GameObject obj)
            {
                mUIObject = obj;

                mCloseBtn = GameObjectExtension.FindChild(obj.transform, "panel/close_btn").gameObject;

                mLoginEntry = new CLoginEntry(GameObjectExtension.FindChild(obj.transform, "panel/main_widget").gameObject);

                mAccountLogin = new CAccountLogin(GameObjectExtension.FindChild(obj.transform, "panel/idlogin_widget").gameObject);

                mRegistAccount = new CRegistLogin(GameObjectExtension.FindChild(obj.transform, "panel/register_widget").gameObject);

                mRealAuth = new CRealAuthenticate(GameObjectExtension.FindChild(obj.transform, "panel/id&phone_widget").gameObject);

                CTipPanel.AutoInit(GameObjectExtension.FindChild(obj.transform, "tips_panel").gameObject);

                UIEventListener.Get(mCloseBtn).onClick += OnClick;
            }
Example #9
0
 public CCardTab(GameObject obj)
 {
     mCardNum = GameObjectExtension.FindChild(obj.transform, "idnum/txt").gameObject.GetComponent <UIInput>();
     mName    = GameObjectExtension.FindChild(obj.transform, "name/txt").gameObject.GetComponent <UIInput>();
     mSubmit  = GameObjectExtension.FindChild(obj.transform, "submit_btn").gameObject;
 }
Example #10
0
 /// <summary>
 /// 自动初始化
 /// </summary>
 public static void AutoInit(GameObject obj)
 {
     mUIObject  = obj;
     mYesUI     = new CYesMsgBox(GameObjectExtension.FindChild(obj.transform, "single_widget").gameObject);
     mYesOrNoUI = new CYesOrNoMsgBox(GameObjectExtension.FindChild(obj.transform, "double_widget").gameObject);
 }
Example #11
0
    protected override void OnNewInstance()
    {
        var ptzCamera = GameObject.Find("PTZCamera");

        GameObject view = m_instance.FindWidget("radar_mid/radar_view");

        EagleEyeMap             = view.GetComponent <UIEagleEyeMap>();
        EagleEyeMap.WorldCamera = ptzCamera.transform.Find("SceneryCamera").GetComponent <Camera>();

        Vector2 WorldOrigin = new Vector2();
        Vector2 WorldSize   = new Vector2();

        int mapHeight = SData_mapdata.Single.GetDataOfID(1).MapMaxRow + 5;//+ DiamondGridMap.SideSize * 2

        DiamondGridMap.Grid2World(mapHeight, DiamondGridMap.SideSize, -DiamondGridMap.SideSize * 2, out WorldOrigin.x, out WorldOrigin.y);

        DiamondGridMap.Grid2World(
            mapHeight,
            SData_mapdata.Single.GetDataOfID(1).MapMaxColumn + DiamondGridMap.SideSize, SData_mapdata.Single.GetDataOfID(1).MapMaxRow,
            out WorldSize.x, out WorldSize.y
            );

        PauseWidget = m_instance.FindWidget("pause_widget");

        RadarHeroHead = m_instance.FindWidget("radar_widget/head_widget").GetComponent <UIWidget>();


        var kills_widget = m_instance.FindWidget("kills_widget");

        for (int i = 1; i <= 5; i++)
        {
            UIKills[i - 1] = kills_widget.transform.FindChild(i.ToString() + "kill").gameObject;
        }

        WorldSize.x -= WorldOrigin.x;
        WorldSize.y -= WorldOrigin.y;

        EagleEyeMap.WorldOrigin = WorldOrigin;
        EagleEyeMap.WorldSize   = WorldSize;
        EagleEyeMap.SetWorldRectChanged();

        //绑定云台相机变换事件
        var posTransform = ptzCamera.GetComponent <PositionTransform>();

        posTransform.OnValueChanged += OnCameraPosChanged;

        var rotationTransform = ptzCamera.GetComponent <RotationTransform>();

        rotationTransform.OnValueChanged += OnCameraRotation;

        // 绑定雷达点击事件
        GameObject radarView = m_instance.FindWidget("radar_widget/content/radar_mid/radar_view");

        UIEventListener.Get(radarView).onClick += OnRadarClick;
        UIEventListener.Get(radarView).onDrag  += OnRadarDrag;

        //连斩相关
        var num_widget_txt   = m_instance.FindWidget("num_widget/txt");
        var tween_widget_txt = m_instance.FindWidget("tween_widget/txt");
        var tween_widget     = m_instance.FindWidget("tween_widget");
        var combo_widget     = m_instance.FindWidget("combo_widget");

        HeroSelectframe = m_instance.FindWidget("content/selectframe");

        var AvatarTextureObj = m_instance.FindWidget("grain");

        CMAvatarTexture = AvatarTextureObj.GetComponent <UITexture>();


        var cutin_widgetObj = m_instance.FindWidget("cutin_widget");
        var grainfx         = GameObjectExtension.FindChild(cutin_widgetObj.transform, "fx");


        AvatarTextureTweens = cutin_widgetObj.GetComponents <UITweener>();
        AvatarFXTweens      = grainfx.GetComponents <UITweener>();



        LianZhan_num_widgetLabel   = num_widget_txt.GetComponent <UILabel>();
        LianZhan_tween_widgetLabel = tween_widget_txt.GetComponent <UILabel>();
        LianZhan_Tweens            = tween_widget.GetComponents <UITweener>();
        LianZhan_Tween             = combo_widget.GetComponent <UITweener>();

        mb_zhuiguang_fx = m_instance.FindWidget("zhuiguang_fx");
        mb_zhuiguang_fx.SetActive(false);
    }