示例#1
0
    public void ForceUpdataCheckFailUI()
    {
        Debug.Log("ForceUpdataCheckFailUI");
        if (loadingView != null)
        {
            loadingView.Dispose();
        }

        if (failView != null)
        {
            return;
        }

        failView = UIPackage.CreateObject("public", "PromptPop").asCom;

        failView.SetSize(GRoot.inst.width, GRoot.inst.height);
        failView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(failView);
        failView.GetController("Prompt").selectedIndex = 11;
        failView.GetChild("Text2").asTextField.text    = "检查更新失败,请确认网络连接后重试";
        failView.GetChild("n9").asButton.onClick.Set(() => {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                return;
            }
            failView.Dispose();
            failView = null;
            Debug.Log("main");
            AppFacade.Instance.StartUp();  //启动游戏
            Debug.Log("StartUp");
            if (gameManager == null)
            {
                gameManager = new GameManager();
            }
            gameManager.AddComponent();
            Timers.inst.Add(1, 1, (pa) => {
                gameManager.Init();
            });

            //gameManager.CheckForceUpdata();
        });
        failView.GetChild("CloseBtn").asButton.visible = false;


        Debug.Log("检查强制更新失败UI");
    }
        public ScrollPaneScene()
        {
            UIPackage.AddPackage("UI/ScrollPane");

            _mainView = UIPackage.CreateObject("ScrollPane", "Main").asCom;
            _mainView.MakeFullScreen();
            _mainView.AddRelation(GRoot.inst, RelationType.Size);
            AddChild(_mainView);

            _list = _mainView.GetChild("list").asList;
            _list.itemRenderer = RenderListItem;
            _list.SetVirtual();
            _list.numItems = 1000;
            _list.onTouchBegin.Add(OnClickList);

            _mainView.GetChild("box").asCom.onDrop.Add(OnDrop);
        }
示例#3
0
    public StoreInfo()
    {
        MsgManager.Instance.AddListener("SC_StoreData", new HandleMsg(this.SC_StoreData));
        //获取数据
        Protomsg.CS_GetStoreData msg1 = new Protomsg.CS_GetStoreData();
        MyKcp.Instance.SendMsg(GameScene.Singleton.m_ServerName, "CS_GetStoreData", msg1);
        AudioManager.Am.Play2DSound(AudioManager.Sound_OpenUI);

        main = UIPackage.CreateObject("GameUI", "StoreMain").asCom;
        GRoot.inst.AddChild(main);
        main.xy = Tool.GetPosition(0.5f, 0.5f);

        main.GetChild("close").asButton.onClick.Add(() =>
        {
            this.Destroy();
        });
    }
示例#4
0
    public override void ConstructFromXML(FairyGUI.Utils.XML cxml)
    {
        base.ConstructFromXML(cxml);

        _name       = this.GetChild("name").asTextField;
        _cost_panel = this.GetChild("cost").asCom;
        _cost1      = _cost_panel.GetChild("cost1").asTextField;
        _cost2      = _cost_panel.GetChild("cost2").asTextField;
        _cost3      = _cost_panel.GetChild("cost3").asTextField;

        _hit   = this.GetChild("hit").asTextField;
        _range = this.GetChild("range").asTextField;
        _spd   = this.GetChild("spd").asTextField;

        _damage_list = this.GetChild("damage").asList;
        _skill_list  = this.GetChild("skills").asList;
    }
示例#5
0
    private void init_ui()
    {
        UIPackage.AddPackage("UI/Gui_DFW");
        com_main = UIPackage.CreateObject("Gui_DFW", "Main").asCom;
        GRoot.inst.AddChild(com_main);

        float Pos_x_MainCom = (Screen.width - com_main.size.x) / 2;
        float Pos_y_MainCom = (Screen.height - com_main.size.y) / 2;

        com_main.SetXY(Pos_x_MainCom, Pos_y_MainCom);

        com_start = com_main.GetChild("Start").asCom;
        com_login = com_start.GetChild("login_registe").asCom;
        com_room  = com_main.GetChild("Room").asCom;

        com_user = com_room.GetChild("user_self").asCom;
    }
示例#6
0
        public override void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            base.Dispose();

            self.Remove();
            self     = null;
            greenBg  = null;
            WinBg    = null;
            SimpleBg = null;
            ShowIn   = null;
            n13      = null;
        }
示例#7
0
 void RenderTreeNode(GTreeNode node, GComponent obj)
 {
     if (node.isFolder)
     {
         obj.text = (string)node.data;
     }
     else if (node.data is string[])
     {
         obj.icon = ((string[])node.data)[1];
         obj.text = ((string[])node.data)[0];
     }
     else
     {
         obj.icon = _fileURL;
         obj.text = (string)node.data;
     }
 }
示例#8
0
        public void Awake(GObject go)
        {
            if (go == null)
            {
                return;
            }

            GObject = go;

            if (string.IsNullOrWhiteSpace(Name))
            {
                Name = Id.ToString();
            }

            self = (GComponent)go;

            self.Add(this);

            var com = go.asCom;

            if (com != null)
            {
                Gro_ShowVersionInfo = com.GetControllerAt(0);
                n0                     = (GImage)com.GetChildAt(0);
                n9                     = (GImage)com.GetChildAt(1);
                n10                    = (GTextField)com.GetChildAt(2);
                Btn_Login              = Btn_Login.Create(com.GetChildAt(3));
                Btn_Registe            = Btn_Registe.Create(com.GetChildAt(4));
                accountInput           = (GImage)com.GetChildAt(5);
                passwordInput          = (GImage)com.GetChildAt(6);
                accountText            = (GTextInput)com.GetChildAt(7);
                Tex_LoginInfo          = (GTextField)com.GetChildAt(8);
                ToTestSceneBtn         = Btn_ToTestScene.Create(com.GetChildAt(9));
                passwordText           = (GTextInput)com.GetChildAt(10);
                Gro_LoginInfo          = (GGroup)com.GetChildAt(11);
                Gros_Detail_BackGround = (GImage)com.GetChildAt(12);
                n26                    = (GTextField)com.GetChildAt(13);
                Gro_Detail             = (GGroup)com.GetChildAt(14);
                Btn_VersionInfo        = Btn_VersionInfo.Create(com.GetChildAt(15));
                Gro_VersionInfo        = (GGroup)com.GetChildAt(16);
                t0                     = com.GetTransitionAt(0);
                t1                     = com.GetTransitionAt(1);
                Anim_VersionHide       = com.GetTransitionAt(2);
                Anim_VersionShow       = com.GetTransitionAt(3);
            }
        }
示例#9
0
 public static void SetAllChildrenRelation(GComponent comp, RelationType relationType = RelationType.Size)
 {
     if (comp == null)
     {
         return;
     }
     if (comp.numChildren > 0)
     {
         GObject[] childrenArr = comp.GetChildren();
         for (int i = 0, len = childrenArr.Length; i < len; i++)
         {
             GObject child = childrenArr[i];
             child.AddRelation(comp, relationType);
             SetAllChildrenRelation(child.asCom, relationType);
         }
     }
 }
    // Use this for initialization
    void Start()
    {
        UIPackage.AddPackage("TestUI");
        GComponent com = UIPackage.CreateObject("TestUI", "RoomMgrPanel").asCom;

        GRoot.inst.AddChild(com);

        GObject com1 = com.GetChild("PlayerInfo");

        if (com1 == null)
        {
            Debug.LogError("没有找到子物体");
            return;
        }
        com1.onClick.Add(OnClick);
        Debug.Log(UIPackage.GetPackages().Count);
    }
示例#11
0
        public override bool Notify(GComponent component, long beforeTime, long afterTime)
        {
            var skeletonCom = component as SkeletonAnimationComponent;
            var socket      = skeletonCom.Pose.FindBonePose(SocketName);
            var mat         = socket.MeshSpaceMatrix;

            //var hostContainer = mHostContainer as GMeshComponent;
            //var skin = hostContainer?.SceneMesh?.MdfQueue.FindModifier<Graphics.Mesh.CGfxSkinModifier>();
            //if (skin == null || skin.MeshSpaceAnimPose == null)
            //    return;
            //var bone = skin.MeshSpaceAnimPose.FindBonePose(value);
            //if (bone == null)
            //    return;
            //ParentSocket = bone;
            //UpdateSocketMatrix(ParentSocket.MeshSpaceMatrix);
            return(base.Notify(component, beforeTime, afterTime));
        }
示例#12
0
    // Use this for initialization
    void Start()
    {
        loadingComponent = GetComponent <UIPanel>().ui;
        loadingBar       = loadingComponent.GetChild("loadingBar").asProgress;
        //loadingButton = loadingComponent.GetChild("loadingButton").asButton;

        //loadingButton.onClick.Add(() => { loadingBar.value += 10; });

        loadingBar.value = 0.0f;
        Debug.Log(loadingBar.value);

        if (SceneManager.GetActiveScene().name == "Loading")
        {
            //启动协程
            StartCoroutine(AsyncLoading());
        }
    }
示例#13
0
	private void PlayWindow()
	{
		GComponent obj = _demoObjects["Window"];
		obj.GetChild("n0").onClick.Add(() =>
		{
			if (_winA == null)
				_winA = new Window1();
			_winA.Show();
		});

		obj.GetChild("n1").onClick.Add(() =>
		{
			if (_winB == null)
				_winB = new Window2();
			_winB.Show();
		});
	}
示例#14
0
        public void Leave()
        {
            NetModule.instance.RemoveACMDListener(Module.BATTLE, Command.ACMD_ENTER_BATTLE, this.OnEnterBattle);
            NetModule.instance.RemoveQCMDListener(Module.ROOM, Command.QCMD_MAP_READY, this.OnMapReadyResult);

            if (this._lb != null)
            {
                this._lb.Cancel();
                this._lb = null;
            }

            if (this._root != null)
            {
                this._root.Dispose();
                this._root = null;
            }
        }
示例#15
0
 void HideMouse(GComponent obj)
 {
     if (obj == null)
     {
         return;
     }
     obj.touchable = false;
     for (int i = 0; i < obj.numChildren; i++)
     {
         GObject item = obj.GetChildAt(i);
         item.touchable = false;
         if (item is GComponent)
         {
             HideMouse((GComponent)item);
         }
     }
 }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/RenderTexture");

        _mainView = UIPackage.CreateObject("RenderTexture", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _testWin = new Window3();

        _mainView.GetChild("n2").onClick.Add(() => { _testWin.Show(); });
    }
示例#17
0
    public void ShowChessInfo(ChessEntity chess)
    {
        GComponent info = (GComponent)UIPackage.CreateObject("ChessInfo", "ChessInfoItem");

        if (info == null)
        {
            Debug.LogError("show chess info error.");
            return;
        }
        this.AddChild(info);

        GTextField name = info.GetChild("name").asTextField;

        name.text = chess.chessCfg.Name;

        m_infos.Add(chess, info);
    }
示例#18
0
    void Start()
    {
        _mainView = this.GetComponent <UIPanel>().ui;

        _folderURL1 = "ui://TreeView/folder_closed";
        _folderURL2 = "ui://TreeView/folder_opened";
        _fileURL    = "ui://TreeView/file";

        _treeView = new TreeView(_mainView.GetChild("tree").asList);
        _treeView.onClickNode.Add(__clickNode);
        _treeView.treeNodeRender = RenderTreeNode;

        TreeNode topNode = new TreeNode(true);

        topNode.data = "I'm a top node";
        _treeView.root.AddChild(topNode);
        for (int i = 0; i < 5; i++)
        {
            TreeNode node = new TreeNode(false);
            node.data = "Hello " + i;
            topNode.AddChild(node);
        }

        TreeNode aFolderNode = new TreeNode(true);

        aFolderNode.data = "A folder node";
        topNode.AddChild(aFolderNode);
        for (int i = 0; i < 5; i++)
        {
            TreeNode node = new TreeNode(false);
            node.data = "Good " + i;
            aFolderNode.AddChild(node);
        }

        for (int i = 0; i < 3; i++)
        {
            TreeNode node = new TreeNode(false);
            node.data = "World " + i;
            topNode.AddChild(node);
        }

        TreeNode anotherTopNode = new TreeNode(false);

        anotherTopNode.data = new string[] { "I'm a top node too", "ui://TreeView/heart" };
        _treeView.root.AddChild(anotherTopNode);
    }
示例#19
0
    void Start()
    {
        _mainView = this.GetComponent <UIPanel>().ui;

        _fileURL = "ui://TreeView/file";

        _tree1 = _mainView.GetChild("tree").asTree;
        _tree1.onClickItem.Add(__clickNode);
        _tree2 = _mainView.GetChild("tree2").asTree;
        _tree2.onClickItem.Add(__clickNode);
        _tree2.treeNodeRender = RenderTreeNode;

        GTreeNode topNode = new GTreeNode(true);

        topNode.data = "I'm a top node";
        _tree2.rootNode.AddChild(topNode);
        for (int i = 0; i < 5; i++)
        {
            GTreeNode node = new GTreeNode(false);
            node.data = "Hello " + i;
            topNode.AddChild(node);
        }

        GTreeNode aFolderNode = new GTreeNode(true);

        aFolderNode.data = "A folder node";
        topNode.AddChild(aFolderNode);
        for (int i = 0; i < 5; i++)
        {
            GTreeNode node = new GTreeNode(false);
            node.data = "Good " + i;
            aFolderNode.AddChild(node);
        }

        for (int i = 0; i < 3; i++)
        {
            GTreeNode node = new GTreeNode(false);
            node.data = "World " + i;
            topNode.AddChild(node);
        }

        GTreeNode anotherTopNode = new GTreeNode(false);

        anotherTopNode.data = new string[] { "I'm a top node too", "ui://TreeView/heart" };
        _tree2.rootNode.AddChild(anotherTopNode);
    }
示例#20
0
        public FWidget(string packageName = null, string componentName = null)
        {
            package   = packageName;
            component = componentName;

            if (string.IsNullOrEmpty(packageName))
            {
                var emptyObj = new GComponent();
                if (!string.IsNullOrEmpty(componentName))
                {
                    emptyObj.name           = componentName;
                    emptyObj.gameObjectName = componentName;
                }

                InitWithObj(emptyObj);
            }
        }
示例#21
0
    public static void NoticeWordsAnim(string word, Google.Protobuf.Collections.RepeatedField <string> p, string anim, int pos = 1)
    {
        // pos 1上 2中 3下
        var showpos = Tool.GetPosition(0.5f, 0.2f);

        if (pos == 1)
        {
            showpos = Tool.GetPosition(0.5f, 0.2f);
        }
        else if (pos == 2)
        {
            showpos = Tool.GetPosition(0.5f, 0.5f);
        }
        else if (pos == 3)
        {
            showpos = Tool.GetPosition(0.5f, 0.8f);
        }
        GComponent words = UIPackage.CreateObject("GameUI", "NoticeWords").asCom;

        //1,直接加到GRoot显示出来
        GRoot.inst.AddChild(words);
        //GRoot.inst.SetChildIndex(words, 1);
        words.xy = showpos;// Tool.GetPosition(0.5f, 0.2f);
        //var root = words.GetComponent<FairyGUI.UIPanel>().ui;

        words.GetChild("word").asTextField.text = word;// noticewords.Words;

        if (p != null && p.Count > 0)
        {
            int index = 1;
            foreach (var item in p)
            {
                Debug.Log("---------------NoticeWords:" + item);
                words.GetChild("word").asTextField.SetVar("p" + index, item);
                index++;
            }
            words.GetChild("word").asTextField.FlushVars();
        }


        FairyGUI.Transition trans = words.GetTransition(anim);
        trans.Play();
        trans.SetHook("over", () => {
            words.Dispose();
        });
    }
示例#22
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _messages = new List <Message>();

        _mainView = this.GetComponent <UIPanel>().ui;

        _list = _mainView.GetChild("list").asList;
        _list.SetVirtual();
        _list.itemProvider = GetListItemResource;
        _list.itemRenderer = RenderListItem;

        _input1 = _mainView.GetChild("input1").asTextInput;
        _input1.onKeyDown.Add(__inputKeyDown1);

        _input2 = _mainView.GetChild("input2").asTextInput;
        _input2.onKeyDown.Add(__inputKeyDown2);

        //作为demo,这里只添加了部分表情素材
        _emojies = new Dictionary <uint, Emoji>();
        for (uint i = 0x1f600; i < 0x1f637; i++)
        {
            string url = UIPackage.GetItemURL("Emoji", Convert.ToString(i, 16));
            if (url != null)
            {
                _emojies.Add(i, new Emoji(url));
            }
        }
        _input2.emojies = _emojies;

        _mainView.GetChild("btnSend1").onClick.Add(__clickSendBtn1);
        _mainView.GetChild("btnSend2").onClick.Add(__clickSendBtn2);

        _mainView.GetChild("btnEmoji1").onClick.Add(__clickEmojiBtn1);
        _mainView.GetChild("btnEmoji2").onClick.Add(__clickEmojiBtn2);

        _emojiSelectUI1 = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom;
        _emojiSelectUI1.fairyBatching = true;
        _emojiSelectUI1.GetChild("list").asList.onClickItem.Add(__clickEmoji1);

        _emojiSelectUI2 = UIPackage.CreateObject("Emoji", "EmojiSelectUI_ios").asCom;
        _emojiSelectUI2.fairyBatching = true;
        _emojiSelectUI2.GetChild("list").asList.onClickItem.Add(__clickEmoji2);
    }
示例#23
0
        public static void CheckUpdate()
        {
            if (uiLoading == null)
            {
                UIPackage.AddPackage("Assets/BundleResources/UI/HotUpdate");
                uiLoading = (GComponent)UIPackage.CreateObject("HotUpdate", "UIHotUpdate");
                uiLoading.MakeFullScreen();
                GRoot.inst.AddChild(uiLoading);

                titleText  = (GTextField)uiLoading.GetChild("titleText");
                loadingBar = (GProgressBar)uiLoading.GetChild("progressBar");
            }

            titleText.text   = "Game Center";
            loadingBar.value = 0;
            loadingBar.TweenValue(100, 1).OnComplete(LoadingCompleteCallDelegate);
        }
        void OnPullUpToRefresh()
        {
            GComponent footer = (GComponent)_list2.scrollPane.footer;

            footer.GetController("c1").selectedIndex = 1;
            _list2.scrollPane.LockFooter(footer.sourceHeight);

            //Simulate a async resquest
            Timers.inst.Add(2, 1, (object param) =>
            {
                _list2.numItems += 5;

                //Refresh completed
                footer.GetController("c1").selectedIndex = 0;
                _list2.scrollPane.LockFooter(0);
            });
        }
示例#25
0
    void Start()
    {
        Hp = 598;
        GRoot.inst.soundVolume = Setting.Sound;
        easyTouch   = GameObject.FindWithTag("EasyTouch");
        gameStart   = GameObject.FindWithTag("GameStart").GetComponent <GameStart>();
        overRequest = GetComponent <GameOverRequest>();
        mainUI      = GetComponent <UIPanel>().ui;
        HpL         = mainUI.GetChild("HpL").asProgress;
        HpR         = mainUI.GetChild("HpR").asProgress;
        Alert       = UIPackage.CreateObject("Lobby", "Alert").asCom;
        outButton   = mainUI.GetChild("out").asButton;

        if (PhotonEngine.isJoin)
        {
            Setup();
        }

        outButton.onClick.Set(() =>
        {
            mainUI.AddChild(Alert);
            Alert.SetPosition(290, 50, 0);
            Transition t = Alert.GetTransition("t0");
            t.SetValue("endsize", 700, 500);
            t.Play(() => { Alert.GetChildAt(1).visible = true; });
            t.SetValue("endsize", 700, 620);
            Alert.GetChildAt(2).visible = false;
            Alert.GetChildAt(3).onClick.Set(() =>
            {
                overRequest.DefaltRequest();
                Transition t1 = Alert.GetTransition("t1");
                t1.Play(() =>
                {
                    SceneManager.LoadScene("Lobby");
                });
                Alert.GetChild("title").visible = false;
            });
            Alert.GetChildAt(4).onClick.Set(() =>
            {
                Transition t1 = Alert.GetTransition("t1");
                t1.Play(() => { mainUI.RemoveChild(Alert); });
                Alert.GetChild("title").visible = false;
            });
        });
    }
示例#26
0
    void __playProgress(object param)
    {
        GComponent obj = _demoObjects["ProgressBar"];
        int        cnt = obj.numChildren;

        for (int i = 0; i < cnt; i++)
        {
            GProgressBar child = obj.GetChildAt(i) as GProgressBar;
            if (child != null)
            {
                child.value += 1;
                if (child.value > child.max)
                {
                    child.value = 0;
                }
            }
        }
    }
示例#27
0
 private void DestroyLodingUI()
 {
     if (_lodingView != null)
     {
         _lodingView.Dispose();
     }
     _lodingView = null;
     if (_msgText != null)
     {
         _msgText.Dispose();
     }
     _msgText = null;
     if (_msgProgress != null)
     {
         _msgProgress.Dispose();
     }
     _msgProgress = null;
 }
示例#28
0
    // Start is called before the first frame update
    void Start()
    {
        mainUI = GetComponent <UIPanel>().ui;

        errorWindow = new ErrorWindow();

        inputPhone   = mainUI.GetChild("inputPhone").asTextInput;
        inputCode    = mainUI.GetChild("inputCode").asTextInput;
        inputPass    = mainUI.GetChild("inputPass").asTextInput;
        inputConfirm = mainUI.GetChild("inputConfirm").asTextInput;

        mainUI.GetChild("btnReset").onClick.Add(btnResetClick);
        mainUI.GetChild("btnGetCode").onClick.Add(btnGetCodeClick);
        mainUI.GetChild("btnLogin").onClick.Add(() =>
        {
            SceneManager.LoadScene("Login");
        });
    }
示例#29
0
        private async void Start()
        {
            ////==== 初始化card 扩展
            UIObjectFactory.SetPackageItemExtension(UICard.URL, typeof(UICard));

            ////=====================


            _mainView = this.GetComponent <UIPanel>().ui;
            if (_mainView != null)
            {
                g_runcost_txt = _mainView.GetChild("run_cost_txt").asTextField;
                g_handComp    = _mainView.GetChild("handcardComp").asCom;
            }

            //test
            this.AddHandCard();
        }
示例#30
0
    void Start()
    {
        _mainView = this.GetComponent <UIPanel>().ui;

        _list = _mainView.GetChild("list").asList;
        _list.itemRenderer = RenderListItem;
        _list.SetVirtual();
        _list.numItems = 1000;
        _list.onTouchBegin.Add(OnClickList);

        _mainView.GetChild("box").asCom.onDrop.Add(OnDrop);

        LongPressGesture gesture = new LongPressGesture(_list);

        gesture.once    = true;
        gesture.trigger = 1f;
        gesture.onAction.Add(OnLongPress);
    }