查看: 1419|回复: 4
打印 上一主题 下一主题

显示/隐藏登录窗口代码_教程

[复制链接]

2508

主题

2

听众

3万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
32806
精华
12

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-5-25 15:43:34 |只看该作者 |倒序浏览
MainWindow窗体的代码:



    using UnityEngine;

     
    using System.Collections;

     
    using Bitverse.Unity.Gui;

     
   

     
    public class mainDemo : MonoBehaviour {

     
   

     
            BitWindow mainwin=null;

     
            BitWindow logwin=null;

     
            BitWindow regwin=null;

     
            private BitEditorStage _form;

     
            // Use this for initialization

     
            void Start () {

     
                    _form=gameObject.GetComponent<BitEditorStage>();

     
                    Component[] windows = gameObject.GetComponents(typeof(BitWindow));

     
                    //Component[] windows = GameObject.Find("main_win");

     
                    logwin=(BitWindow)GameObject.Find("log").GetComponent(typeof(BitWindow));

     
                    regwin=(BitWindow)GameObject.Find("reg").GetComponent(typeof(BitWindow));

     
                    for(int i=0;i<windows.Length;i++)

     
                    {

     
                            if(windows.name=="main_win"){

     
                                            mainwin=(BitWindow)windows;

     
                                    }

     
                            if(windows.name=="log"){

     
                                            logwin=(BitWindow)windows;

     
                                    }

     
                    }

     
                    if(mainwin==null){

     
                                    Debug.LogError("mainwin window not found");

     
                                    return;

     
                            }

     
                    if(logwin==null){

     
                                    Debug.LogError("logwin window not found");

     
                                    return;

     
                            }

     
                    if(regwin==null){

     
                            Debug.LogError("regwin window not found");

     
                            return;

     
                    }

     
                    BitButton b1=mainwin.FindControl<BitButton>("log");

     
                    b1.MouseClick+=hideClick;

     
                    BitButton b2=mainwin.FindControl<BitButton>("reg");

     
                    b2.MouseClick+=hideClickReg;

     
                           

     
            }

     
            private void hideClick(object sender,MouseEventArgs e)

     
            {

     
                    logwin.Visible=***e;

     
            }

     
            private void hideClickReg(object sender,MouseEventArgs e)

     
            {

     
                    regwin.Visible=***e;

     
                    

     
                    //regwin.Visible=***e;

     
            }

     
            

     
            // Update is called once per frame

     
            void Update () {

     
                    

     
            }

     
    }


复制代码
LoginWindow窗体代码:



    using UnityEngine;

     
    using System.Collections;

     
    using Bitverse.Unity.Gui;

     
   

     
    public class logDemo : MonoBehaviour {

     
   

     
            BitWindow logwin=null;

     
            

     
            void Awake(){

     
                    logwin=(BitWindow)GameObject.Find("log").GetComponent(typeof(BitWindow));

     
                    logwin.Visible=false;

     
            }

     
            

     
            // Use this for initialization

     
            void Start () {

     
                    

     
                    //logwin=(BitWindow)gameObject.GetComponent(typeof(BitWindow));

     
                    

     
                    

     
                    if(logwin==null){

     
                                    Debug.LogError("logwin window not found");

     
                                    return;

     
                            }

     
                    BitButton b1=logwin.FindControl<BitButton>("btexit");

     
                    b1.MouseClick+=hideClick;

     
                    

     
            }

     
            private void hideClick(object sender,MouseEventArgs e)

     
            {

     
                    logwin.Visible=false;

     
            }

     
            

     
            // Update is called once per frame

     
            void Update () {

     
                    

     
            }

     
    }


分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

Zack    

459

主题

1

听众

5478

积分

高级设计师

Rank: 6Rank: 6

纳金币
5531
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2012-11-25 03:43:52 |只看该作者
学习了。谢谢!


回复

使用道具 举报

2317

主题

54

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
20645
精华
62

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2012-11-30 04:20:34 |只看该作者
楼主的帖子不错呀
回复

使用道具 举报

.    

3797

主题

11

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
32328
精华
41

活跃会员 优秀版主 荣誉管理 论坛元老

地板
发表于 2012-12-28 20:12:50 |只看该作者
谢谢楼主的用心分享,顶一个~~!!
回复

使用道具 举报

2722

主题

42

听众

3万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
38268
精华
111

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

5#
发表于 2012-12-31 03:50:12 |只看该作者
谢谢楼主的帖子分享,学习了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-7-24 10:00 , Processed in 0.299543 second(s), 29 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部