Beispiel #1
0
        public void Awake(Unit hero, FUI headBar)
        {
            this.m_Hero = hero;
            HeroDataComponent heroDataComponent = hero.GetComponent <HeroDataComponent>();

            this.m_HeadBar = headBar as FUIHeadBar;
            //这个血量最大值有点特殊,还需要设置一下密度用事件比较好一点

            this.SetDensityOfBar(this.m_Hero.GetComponent <HeroDataComponent>().GetAttribute(NumericType.MaxHp));
            this.m_HeadBar.Bar_HP.self.value = heroDataComponent.GetAttribute(NumericType.MaxHp);
            this.m_HeadBar.Bar_MP.self.max   = heroDataComponent.GetAttribute(NumericType.MaxMp);
            this.m_HeadBar.Bar_MP.self.value = heroDataComponent.GetAttribute(NumericType.MaxMp);
        }
Beispiel #2
0
        public override void Awake(FUIMainItfComponent self)
        {
            FUI FGUICompunt = self.GetParent <FUI>();

            self.m_point = FGUICompunt.Get("point");

            self.m_BoomPoint = FGUICompunt.Get("BoomPoint");

            self.m_HP = FGUICompunt.Get("hp");

            TurretComponent.UpdatePos += self.UpdateBoomPoint;

            Tank.m_hpChange += self.HpChange;
        }
Beispiel #3
0
        public static async ETTask <FUI> Create <T, P1, P2, P3>(string packageName, P1 p1, P2 p2, P3 p3) where T : FUIBase
        {
            await ETTask.CompletedTask;

            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(packageName);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(packageName, packageName));

            fui.Name = packageName;

            fui.AddComponent(typeof(T), p1, p2, p3);

            Game.Scene.GetComponent <FUIComponent>().Add(fui);

            return(fui);
        }
Beispiel #4
0
        public static async ETTask <FUI> Create()
        {
            await ETTask.CompletedTask;

            // 可以同步或者异步加载,异步加载需要搞个转圈圈,这里为了简单使用同步加载
            // await ETModel.Game.Scene.GetComponent<FUIPackageComponent>().AddPackageAsync(FUIType.Login);
            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(FUIType.Login);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(FUIType.Login, FUIType.Login));

            fui.Name = FUIType.Login;

            // 这里可以根据UI逻辑的复杂度关联性,拆分成多个小组件来写逻辑,这里逻辑比较简单就只使用一个组件了
            fui.AddComponent <FUILoginComponent>();

            return(fui);
        }
Beispiel #5
0
        public void AddToGroup(FUI fui, ViewGroup grp)
        {
            if (!(fui.GObject is GComponent com))
            {
                throw new Exception($"this ui is not GComponent,  {fui.Name}");
            }
            int newComDepth;

            if (com.packageItem != null)
            {
                newComDepth = GetViewDepth(com.packageItem.name);
            }
            else
            {
                newComDepth = s_cDefaultViewDepth;
            }
            if (grp != ViewGroup.None && m_FGUIGrps[(int)grp] != null)
            {
                //GComponent viewGrp = m_FGUIGrps[(int)grp];
                FUI viewGrp = m_FGUIGrps[(int)ViewGroup.View];
                int iIndex  = viewGrp.numChildren;
                for (int i = 0; i < viewGrp.numChildren; i++)
                {
                    GObject child = viewGrp.GObject.asCom.GetChildAt(i);
                    if (child == null)
                    {
                        continue;
                    }
                    int childDepth;
                    if (child.packageItem == null)
                    {
                        childDepth = s_cDefaultViewDepth;
                    }
                    else
                    {
                        childDepth = GetViewDepth(child.packageItem.name);
                    }
                    if (childDepth > newComDepth)
                    {
                        iIndex = i;
                        break;
                    }
                }
                viewGrp.Add(fui, iIndex);
            }
        }
Beispiel #6
0
        protected override void Run(ETModel.Session session, B2C_StartNextRound message)
        {
            FUI fui = Game.Scene.GetComponent <FUIComponent>().Get(FUIType.MainInterface);

            if (fui != null)
            {
                fui.GetComponent <MainItfViewComponent>().AddTotalRound();
            }

            foreach (TankFrameInfo tankInfo in message.TankFrameInfos)
            {
                Tank tank = ETModel.Game.Scene.GetComponent <TankComponent>().Get(tankInfo.TankId);

                tank.Position = new Vector3(tankInfo.PX * 1f / Tank.m_coefficient, tankInfo.PY * 1f / Tank.m_coefficient,
                                            tankInfo.PZ * 1f / Tank.m_coefficient);

                tank.Reset();
            }
        }
Beispiel #7
0
        private FUI CreateLayer(int layer)
        {
            GComponent com = UIPackage.CreateObject("RootLayer", "RootLayer").asCom;

            com.gameObjectName = ((ViewGroup)layer).ToString();

            com.SetSize(GRoot.inst.width, GRoot.inst.height);

            com.AddRelation(GRoot.inst, RelationType.Size);

            FUI fui = ComponentFactory.Create <FUI, GObject>(com);



            fui.Name = ((ViewGroup)layer).ToString();

            this.Root.Add(fui, layer);

            return(fui);
        }
Beispiel #8
0
        public static async ETTask <FUI> Create <T>(string packageName) where T : FUIBase
        {
            await ETTask.CompletedTask;



            // 可以同步或者异步加载,异步加载需要搞个转圈圈,这里为了简单使用同步加载
            // await ETModel.Game.Scene.GetComponent<FUIPackageComponent>().AddPackageAsync(FUIType.Login);
            ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(packageName);

            FUI fui = ComponentFactory.Create <FUI, GObject>(UIPackage.CreateObject(packageName, packageName));

            fui.Name = packageName;

            // 这里可以根据UI逻辑的复杂度关联性,拆分成多个小组件来写逻辑,这里逻辑比较简单就只使用一个组件了
            fui.AddComponent(typeof(T));

            Game.Scene.GetComponent <FUIComponent>().Add(fui);

            return(fui);
        }
        protected override void Run(ETModel.Session session, G2C_ChatMessage message)
        {
            if (message.ChatType == ChatType.Hall)
            {
                FUI fui = Game.Scene.GetComponent <FUIComponent>().Get(FUIType.Hall);

                if (fui != null)
                {
                    fui.GetComponent <HallViewComponent>().UpdateChatInfo(message);
                }
            }
            else if (message.ChatType == ChatType.Room)
            {
                FUI fui = Game.Scene.GetComponent <FUIComponent>().Get(FUIType.Room);

                if (fui != null)
                {
                    fui.GetComponent <RoomViewComponent>().UpdateChatInfo(message);
                }
            }
        }
Beispiel #10
0
        public static FUI CreateFUI(string uiType)
        {
            try
            {
                ETModel.Game.Scene.GetComponent <FUIPackageComponent>().AddPackage(uiType);

                FUI fui = EntityFactory.Create <FUI, string, GObject>(Game.Scene, uiType, UIPackage.CreateObject(uiType, uiType));
                fui.Name = uiType;

                // 挂上窗口组件就成了窗口
                FUIWindowComponent fWindow = fui.AddComponent <FUIWindowComponent>();
                fWindow.Modal = true;
                fWindow.Show();

                return(fui);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(null);
            }
        }
Beispiel #11
0
        protected override void Run(ETModel.Session session, B2C_TankDie message)
        {
            FUI fui = Game.Scene.GetComponent <FUIComponent>().Get(FUIType.MainInterface);

            if (fui != null)
            {
                Tank tank = ETModel.Game.Scene.GetComponent <TankComponent>().Get(message.DieTandkId);

                if (tank == null)
                {
                    Log.Error($"不存在坦克{message.DieTandkId}");
                    return;
                }
                if (tank.TankCamp == TankCamp.Left)
                {
                    fui.GetComponent <MainItfViewComponent>().LeftWin();
                }
                else
                {
                    fui.GetComponent <MainItfViewComponent>().RightWin();
                }
            }
        }
        protected override void Run(ETModel.Session session, B2C_RoundEnd message)
        {
            Log.Warning($"胜利方{message.WinCamp}");

            FUI fui = Game.Scene.GetComponent <FUIComponent>().Get(FUIType.MainInterface);

            if (fui != null)
            {
                if (message.WinCamp == 1)
                {
                    fui.GetComponent <MainItfViewComponent>().LeftWin();
                }
                else if (message.WinCamp == 2)
                {
                    fui.GetComponent <MainItfViewComponent>().RightWin();
                }
                else
                {
                    Log.Error($"winCamp {message.WinCamp} 有误");
                }
            }

            //ETModel.Game.Scene.GetComponent<TankComponent>().MyTank.GetComponent<LocalTankComponent>().StopMove = true;
        }
Beispiel #13
0
        public void Add(FUI ui, ViewGroup grp = ViewGroup.View)
        {
            grp = ViewGroup.View;

            AddToGroup(ui, grp);
        }
Beispiel #14
0
 public void Add(FUI ui, bool asChildGObject)
 {
     Root?.Add(ui, asChildGObject);
 }
Beispiel #15
0
 public override void Run()
 {
     FUI.Open(typeof(LoginSceneUI_FairyGUI));
 }
Beispiel #16
0
 public void Push(FUI fui)
 {
     uis.Peek().Visible = false;
     uis.Push(fui);
 }
Beispiel #17
0
        public FUI Get(string name)
        {
            FUI ui = this.Root.Get(name);

            return(ui);
        }
Beispiel #18
0
 public void Add(FUI ui)
 {
     this.Root.Add(ui);
 }
Beispiel #19
0
        public override void Run()
        {
            FUI fUI = UIFactory.CreateFUI(FUIType.UILobby);

            Game.Scene.GetComponent <FUIComponent>().Add(fUI);
        }
Beispiel #20
0
        public override void Run(string a, PopMessageType b)
        {
            FUI fui = Game.Scene.GetComponent <FUIComponent>().Get(FUIType.PopMessage);

            fui.GetComponent <PopMessageViewComponent>().AddEmitTip(a, b);
        }