Пример #1
0
 public virtual FreeUIUtil.Rectangle GetItemRegion(IEventArgs args, int screenW, int screenH)
 {
     Initial(args);
     FreeUIUtil.Rectangle rec = FreeUIUtil.GetXY(0, 0, screenW, screenH, iX, iY, FreeUtil.ReplaceInt(relative, args));
     rec.width  = iWidth;
     rec.height = iHeight;
     return(rec);
 }
Пример #2
0
        private void TestMapData(Contexts contexts)
        {
            contexts.ui.map.RouteLineStartPoint = new MapFixedVector2(10, 6);
            contexts.ui.map.RouteLineEndPoint   = new MapFixedVector2(50, 30);

            contexts.ui.map.OffLineLevel = 1;
            contexts.ui.map.CurPlayer    = new MiniMapTeamPlayInfo();
            contexts.ui.map.TeamInfos    = new List <MiniMapTeamPlayInfo>();

            contexts.ui.map.CurDuquan  = new DuQuanInfo(contexts.ui.map.OffLineLevel, new MapFixedVector2(15, 15), 5, 5, 60);
            contexts.ui.map.NextDuquan = new DuQuanInfo(contexts.ui.map.OffLineLevel, new MapFixedVector2(25, 25), 3, 10, 140);
            contexts.ui.map.BombArea   = new BombAreaInfo(new MapFixedVector2(15, 15), 5, contexts.ui.map.OffLineLevel);
            contexts.ui.map.PlaneData  = new AirPlaneData()
            {
                Type = 1, Pos = new MapFixedVector3(28, 100, 28), Direction = 90f
            };
            contexts.ui.map.TeamPlayerMarkInfos = new List <TeamPlayerMarkInfo>();
            contexts.ui.map.MapMarks            = new Dictionary <long, MiniMapPlayMarkInfo>();

//            var go = new GameObject("plane");
//            var plane = go.AddComponent<FreeRenderObject>();
//            plane.raderImage = new RaderImage();
//            plane.key = "plane";
//            plane.model3D.x = 14;
//            plane.model3D.z = 14;
//            plane.AddEffect(FreeUIUtil.GetInstance().GetEffect(1));
//            SingletonManager.Get<FreeEffectManager>().AddEffect(plane);

            var go    = new GameObject("plane");
            var plane = go.AddComponent <FreeRenderObject>();

            plane.raderImage = new RaderImage();
            plane.key        = "plane";
            plane.model3D.x  = -15;
            plane.model3D.z  = -15;
            plane.AddEffect(FreeUIUtil.GetInstance().GetEffect(1));
            SingletonManager.Get <FreeEffectManager>().AddEffect(plane);

            DOTween.To(() => plane.model3D.x, x => plane.model3D.x = x, 15, 30);
            DOTween.To(() => plane.model3D.z, x => plane.model3D.z = x, 15, 30);

            contexts.ui.map.IsShowRouteLine     = true;
            contexts.ui.map.RouteLineStartPoint = new MapFixedVector2(0, 0);
            contexts.ui.map.RouteLineEndPoint   = new MapFixedVector2(28, 28);
        }
Пример #3
0
        // ks ks[0]为无效字段,一个component一个值,代表类型
        // fs 一个component9个值,代表x,y,z, sx,sy,sz, rx,ry,rz
        // bs[0] 表示初始是否展示UI
        // ss ss[0]为UI的key, ss[1]为UI的 autos, 一个component2个值,代表初始化的值
        private FreeRenderObject build(SimpleProto sp)
        {
            var go = new GameObject(sp.Ss[0]);
            var ui = go.AddComponent <FreeRenderObject>();

            ui.key            = sp.Ss[0];
            ui.raderImage     = new RaderImage();
            ui.raderImage.img = sp.Ss[1];
            ui.Visible        = sp.Bs[0];
            ui.needPvs        = sp.Bs[1];

            ui.SetPos(sp.Fs[0], sp.Fs[1], sp.Fs[2],
                      sp.Fs[3], sp.Fs[4], sp.Fs[5],
                      sp.Fs[6], sp.Fs[7], sp.Fs[8]);

            for (var i = 1; i < sp.Ks.Count; i++)
            {
                var newPo = FreeUIUtil.GetInstance().GetEffect(sp.Ks[i]);

                if (newPo == null)
                {
                    Logger.ErrorFormat("Effect Component is not exist {0}", sp.Ks[i]);
                    continue;
                }

                newPo.Initial(sp.Ss[i * 2 + 2], sp.Ss[i * 2 + 3]);

                newPo.SetPos(sp.Fs[9 * i], sp.Fs[9 * i + 1], sp.Fs[9 * i + 2],
                             sp.Fs[9 * i + 3], sp.Fs[9 * i + 4], sp.Fs[9 * i + 5],
                             sp.Fs[9 * i + 6], sp.Fs[9 * i + 7], sp.Fs[9 * i + 8]);

                ui.AddEffect(newPo);
            }

            ui.InitialAuto(sp.Ss[2]);

            return(ui);
        }
Пример #4
0
        private void Handle(SimpleProto value, SimpleProto model, GameObject parentObj)
        {
            for (var i = 0; i < model.Ks.Count - 1; i++)
            {
                var newPo = FreeUIUtil.GetInstance().GetComponent(model.Ks[i + 1]);
                if (newPo == null)
                {
                    Logger.ErrorFormat("Free component not exist {0}", model.Ks[i + 1]);
                    continue;
                }

                newPo.Initial(model.Ss[i * 3 + 2], model.Ss[i * 3 + 3]);

                if (newPo is FreePrefabComponent)
                {
                    FreePrefabComponent ff = (FreePrefabComponent)newPo;
                    ff.SetValues(value.Ss[2]);
                    ff.SetEvents(value.Ss[3]);
                    ff.SetAllEventKey(value.Ss[4]);

                    ff.parentObject = parentObj;
                }
            }
        }
Пример #5
0
        private int GetY(ItemInventory inventory, IEventArgs args, SimpleInventoryUI ui, ItemPosition ip, FreeImageComponet back)
        {
            int heightMargin = ui.GetHeightMargin(inventory, args);

            return(ui.GetY(args) + FreeUIUtil.GetDownY(FreeUtil.ReplaceInt(ui.relative, args), ip.GetY() * (ui.itemHeight + heightMargin)));
        }
Пример #6
0
        private int GetX(ItemInventory inventory, IEventArgs args, SimpleInventoryUI ui, ItemPosition ip, FreeImageComponet back)
        {
            int widthMargin = ui.GetWidthMargin(inventory, args);

            return(ui.GetX(args) + FreeUIUtil.GetRightX(FreeUtil.ReplaceInt(ui.relative, args), ip.GetX() * (ui.itemWidth + widthMargin)));
        }