// 显示指定玩家的牌型图标 void showNiu(int uid, int type) { var p = Data.Game.GetPlayer(uid); if (p == null) { return; } GComponent niu = UIPackage.CreateObject("qipai", "niu").asCom; var cp = cardPlaces[p.Index]; var cpos = cp.position; niu.GetController("niu").selectedIndex = type; niu.visible = true; if (uid == Data.User.Id) { cpos.y += 65; cpos.x += 65; niu.SetScale(1.4f, 1.4f); } else { cpos.y += 45; cpos.x += 30; niu.SetScale(0.8f, 0.8f); } niu.position = cpos; niu.AddRelation(cp, RelationType.Middle_Middle, true); niu.AddRelation(cp, RelationType.Center_Center, true); ui.AddChild(niu); nius.Add(niu); }
public BaseMediator ShowView <T> (bool isEffect = true, bool ifMask = true) { BaseMediator view = Activator.CreateInstance <T> () as BaseMediator; views.Add(view); v.AddChild(view.group); SetMask(); if (!ifMask) { mask.alpha = 0; } else { mask.alpha = 1; } if (isEffect) { GRoot.inst.touchable = false; EffectManager.inst.ShowView(view.group, () => { GRoot.inst.touchable = true; view.group.InvalidateBatchingState(); }); } return(view); }
public void ShowScene <T> (bool isRemove = false) { if (sceneMask == null) { sceneMask = Tools.GetComponent(Config.COM_SCENEMASK).asCom; s.AddChild(sceneMask); ViewManager.SetWidthHeight(sceneMask); } scenes.Add(typeof(T)); if (isRemove) { if (scenes.Count != 0) { scenes.RemoveAt(scenes.Count - 1); } } if (scene != null) { s.RemoveChild(scene.group, true); scene = null; } this.ClearViews(); BaseMediator view = Activator.CreateInstance <T> () as BaseMediator; scene = view; s.AddChild(view.group); EffectManager.inst.TweenAlpha(view.group, 0.3f, 0.5f, 1f); }
/// 重启时更新所有UI public void ResetAllLayer() { RemoveAllLayers(); if (_root != null) { _root.AddChild(GetUILayer()); _root.AddChild(GetMSGLayer()); _root.AddChild(GetLoaderLayer()); _root.AddChild(GetTopLayer()); } }
/// <summary> /// 初始化所有层级组件容器 /// </summary> void InitLayers(GComponent root) { if (_root == null) { root.AddChild(GetUILayer()); root.AddChild(GetMSGLayer()); root.AddChild(GetLoaderLayer()); root.AddChild(GetTopLayer()); } _root = root; }
private void ShowGamePrompt() { gamePrompt = UIPackage.CreateObject("Loader", "GamePrompt").asCom; if (gamePrompt != null) { compContainer.AddChild(gamePrompt); Transition fadeIn = gamePrompt.GetTransition("fadeIn"); if (fadeIn != null) { fadeIn.Play(PlayGamePromptFadeOut); } } }
/// <summary> /// 打开列表 /// </summary> private void OpenList() { haveList = true; mainUI.AddChild(list); if ((float)Screen.width / 39 >= (float)Screen.height / 18.0f) { list.SetPosition(1280 * 0.8f, 720 * 0.4f, 0); } else if ((float)Screen.width / 2 >= Screen.height) { list.SetPosition(1280 * 0.75f, 720 * 0.4f, 0); } else { list.SetPosition(1280 * 0.7f, 720 * 0.4f, 0); } //mainUI.GetChild("Screen").text = list.position.x +"/"+Screen.width+ "\n" + list.position.y+"/"+Screen.height; list.touchable = false; Transition t = list.GetTransition("t0"); t.Play(() => { list.touchable = true; }); list.GetChild("n0").asCom.GetChildAt(0).onClick.Set(() => { CloseList(); Room(); //SceneManager.LoadScene("Talk"); }); list.GetChild("n0").asCom.GetChildAt(1).onClick.Set(CloseList); list.GetChild("n0").asCom.GetChildAt(2).onClick.Set(() => { if (change) { CloseList(); mainUI.GetTransition("t0").Play(); Zedclone = GameObject.Instantiate(zed, new Vector3(0.36f, 1.390813f, 1.14685f), Quaternion.identity); ani = GameObject.FindWithTag("Player").GetComponentsInChildren <Animator>(); Invoke("ChangeAnima", 5.1f); audioSource.Play(); list.GetChild("n0").asCom.GetChildAt(2).touchable = false; list.GetChild("n0").asCom.GetChildAt(0).touchable = false; Invoke("ResetButton", 6f); } else { CloseList(); ChangeAnima(); } }); list.GetChild("n0").asCom.GetChildAt(3).onClick.Set(SubList); }
private void Pop(GComponent parent, VEntity target, string font, string text) { parent.AddChild(this); this._numberText.fontName = font; this._numberText.text = text; this._numberText.position = new Vector2(-this._numberText.size.x * 0.5f, 0); this._pointInWorld = target.position; this._offsetHeight = target.size.y; this.UpdatePosition(); this._tweenPos.x = 0; this._tweenPos.y = 0; float toX = 0; float toY = JITTER_FACTOR.y; this.alpha = 1; DOTween.To(() => new Vector2(this._tweenPos.x, this._tweenPos.y), val => { this._tweenPos.x = val.x; this._tweenPos.y = val.y; }, new Vector2(toX, toY), 1.6f).OnUpdate(this.UpdatePosition).SetTarget(this).SetUpdate(false); this.TweenFade(0, 0.8f).SetDelay(0.8f) .OnUpdate(this.UpdatePosition).SetUpdate(false) .OnComplete(this.OnCompleted); }
void SetPageSoft(GComponent obj, bool front) { obj.touchable = false; obj.displayObject.cacheAsBitmap = false; DisplayObject mask = front ? _mask1.displayObject : _mask2.displayObject; obj.mask = mask; PolygonMesh mesh = mask.graphics.GetMeshFactory <PolygonMesh>(); mesh.usePercentPositions = false; mesh.points.Clear(); mesh.texcoords.Clear(); mask.graphics.SetMeshDirty(); if (front) { mesh.Add(new Vector2(0, _pageHeight)); mesh.Add(Vector2.zero); mesh.Add(new Vector2(_pageWidth, 0)); mesh.Add(new Vector2(_pageWidth, _pageHeight)); } else if (_softShadow != null) { obj.AddChild(_softShadow); } }
private void runDemo(EventContext context) { string type = ((GObject)(context.sender)).name.Substring(4); GComponent obj; if (!_demoObjects.TryGetValue(type, out obj)) { obj = UIPackage.CreateObject("Basics", "Demo_" + type).asCom; _demoObjects[type] = obj; } _demoContainer.RemoveChildren(); _demoContainer.AddChild(obj); _viewController.selectedIndex = 1; _backBtn.visible = true; switch (type) { case "Graph": PlayGraph(); break; case "Button": PlayButton(); break; case "Text": PlayText(); break; case "Grid": PlayGrid(); break; case "Transition": PlayTransition(); break; case "Window": PlayWindow(); break; case "Popup": PlayPopup(); break; case "Drag&Drop": PlayDragDrop(); break; case "Depth": PlayDepth(); break; case "ProgressBar": PlayProgressBar(); break; } }
public void ShowOn(GComponent r) { // GComponent r = target != null ? target : GRoot.inst; this.contentPane.x = r.width - this.contentPane.width - 10; this.contentPane.y = (r.height - this.contentPane.height) * 0.3f; this.contentPane.visible = true; r.AddChild(this.contentPane); }
public void ShowAlert(string text, ModelAlert.AlertEvent fun = null, bool isYesAndNo = false, bool close = false) { ModelAlert model = ModelManager.inst.alertModel; model.text = text; model.onAlert = fun; model.isYesAndNo = isYesAndNo; model.close = close; model.showType = 0; CloseAlert(); alert = new ComAlert(); t.AddChild(alert.group); SetTMask(); EffectManager.inst.ShowView(alert.group); }
public void InitSweet(GComponent parents) { _parents = parents; _sweet.visible = true; _type = SweetsType.EMPTY; parents.AddChild(_sweet); SetSweetsType(_type); }
public PokePai(string pai, GComponent parent) { this.parent = parent; _back = UIPackage.CreateObject("baijiale", "pokeBack").asCom; _back.pivot = new Vector2(0.5f, 0.5f); parent.AddChild(_back); SetPai(pai); }
void Start() { UIPackage.AddPackage("RightView"); _skillView = UIPackage.CreateObject("RightView", "Main").asCom; _mainView = this.GetComponent <UIPanel>().ui; _mainView.AddChild(_skillView); Vector2 main_view_size = _mainView.size; _skillView.SetSize(main_view_size.x, main_view_size.y); _skill = new GButton[_skill_num]; _mask = new GImage[_skill_num]; for (int i = 0; i < _skill_num; ++i) { _skill[i] = _skillView.GetChild("b" + (i + 1).ToString()).asButton; _skill[i].icon = UIPackage.GetItemURL("RightView", i.ToString()); _skill[i].draggable = true; GButton btn = _skill[i]; int index = i; btn.onDragStart.Add((EventContext context) => { context.PreventDefault(); if ((int)WeaponType.WT_INVALID == _cur_weapon[index]) { context.StopPropagation(); return; } is_over_skill_icon = false; // 让其它图标可拖拽 DragDropManager.inst.StartDrag(btn, btn.icon, btn.icon, (int)context.data); }); btn.onTouchBegin.Add((EventContext context) => { is_over_skill_icon = false; onTouchDown(context, index); }); _mask[i] = _skill[i].GetChild("mask").asImage; _mask[i].fillAmount = 0; } touchId = -1; _animator = GameObject.FindWithTag(Tags.MainRole).GetComponent <Animator>(); hash = GameObject.FindWithTag(Tags.GameController).GetComponent <HashIDs>(); _animator.SetInteger(hash.WeaponStateInt, (int)WeaponState.WS_INVALID); GameObject[] object_list = GameObject.FindGameObjectsWithTag(Tags.MainRole); foreach (GameObject go in object_list) { Debug.Log("objec_list = " + go.tag); } }
/// <summary> /// Start dragging. /// 开始拖动。 /// </summary> /// <param name="source">Source object. This is the object which initiated the dragging.</param> /// <param name="icon">Icon to be used as the dragging sign.</param> /// <param name="sourceData">Custom data. You can get it in the onDrop event data.</param> /// <param name="touchPointID">Copy the touchId from InputEvent to here, if has one.</param> public void StartDrag(GObject source, object sourceData, Vector2 cha, int touchPointID = -1) { if (_agent.parent == null) { _source = source; _agent.AddChild(_source); GRoot.inst.AddChild(_agent); _sourceData = sourceData; FollowMouse(cha); _agent.StartDrag(touchPointID); } }
public void ShowView(GComponent view) { if (viewDic.ContainsKey(view.displayObject.gameObject.name)) { view.visible = true; } else { uiLayer.AddChild(view); viewDic[view.displayObject.gameObject.name] = view; } }
public void StartMove(GComponent source, GObject rect, Vector2 cha) { _cha = cha; _rect = rect; End(); if (_agent.parent == null) { Source = source; _agent.AddChild(Source); GRoot.inst.AddChild(_agent); } }
public void addMonsterView(EnemyCombo enemyInfo, Vector2 originPos) { MonsterCardComponent item = (MonsterCardComponent)UIPackage.CreateObject("UIMain", "MonsterCard").asCom; monsterContianer.AddChild(item); item.SetXY(-100, -100); //item.setName (enemyInfo.enemyId+""); item.setInfo(enemyInfo); item.visible = false; showAddMonsterEffect(originPos, monsterContianer.LocalToGlobal(item.position), item); reArrangeEnemies(); }
public void Reset() { _sweet.visible = true; _parents.AddChild(_sweet); SetSweetsType(SweetsType.EMPTY); if (_normalClearTra.playing) { _normalClearTra.Stop(); } x = 0; y = 0; }
public void Create(string name, bool isAuto = false, string title = null) { uiName = name; listen = new Dictionary <string, List <Action <MainEvent> > >(); string[] names = name.Split(':'); view = UIPackage.CreateObject(names[0], names[1]).asCom; group = new GComponent(); if (isAuto) { view.width = GRoot.inst.width; view.height = GRoot.inst.height; } // view.onRemovedFromStage.Add(() => // { // Debug.LogError("onRemovedFromStage " + uiName); // this.ClearListener(); // this.Clear(); // }); view.onRemovedFromStage.Add(Clear); // if (titleText != null) // { //title = Tools.GetComponent (Config.COM_TITLE).asCom; //group.AddChild (title); //group.AddChild (view); //title.width = view.width - 5; //title.x = 2; //title.y = 0; //view.y += title.height + 5; //btn_Close = title.GetChild ("n2").asButton; //btn_Close.onClick.Add (this.Close); //this.text = isAddTitle; // } // else // { group.AddChild(view); // } group.width = view.width; // if (titleText != null) // group.height = view.height + title.height + 5; // else group.height = view.height; // group.fairyBatching = true; group.SetPivot(0.5f, 0.5f, false); group.Center(); // Debug.LogError ("GRoot.inst.fairyBatching :: " + GRoot.inst.fairyBatching.ToString()); this.CheckTitle(title); }
//type 0正常 1条件 // public int[] GetData (int type) // { // if (type == GUIDE_NORMAL) // return new int[]{ this.guide11, this.guide12 }; // else // return new int[]{ this.guide21, this.guide22 }; // } public void Clear() { if (v != null && ps != null && ps.parent != null) { if (curData.ContainsKey("addp") && curData ["addp"].ToString() == "1") { v.x -= ps.x; v.y -= ps.y; } if (v_pre != null && v_pre.x > 0) { v.x = v_pre.x; v.y = v_pre.y; } v.touchable = true; ps.AddChild(v); v = null; ps = null; } else if (v != null && p != null && p.parent != null) { if (curData.ContainsKey("addp") && curData ["addp"].ToString() == "1") { if (curCheck == "101:1" || curCheck == "101:2") { v.x = v.x - p.x - p.parent.x - p.parent.parent.x; v.y = v.y - p.y - p.parent.y - p.parent.parent.y; } else { v.x -= p.x; v.y -= p.y; } } v.touchable = true; if (v_pre != null && v_pre.x > 0) { v.x = v_pre.x; v.y = v_pre.y; } p.AddChild(v); v = null; } add.RemoveChildren(0, -1, true); if (hand != null) { view.RemoveChild(hand); hand.Dispose(); hand = null; } this.stage.visible = false; }
private void CreateContainer(GObject obj) { GComponent graph = new GComponent(); obj.parent.AddChild(graph); graph.xy = obj.xy; graph.size = obj.size; obj.xy = Vector2.zero; graph.AddChild(obj); _gContainer = graph; _containerDownline = graph.container; _rectRaw = new Rect(_containerDownline.x, _containerDownline.y, _containerDownline.width, _containerDownline.height); }
void CreatMap(THClimbTower.EventType type, params object[] Param) { Map map = Param[0] as Map; GTile.RemoveChildren(0, GTile.numChildren, true); GLine.RemoveChildren(0, GLine.numChildren, true); foreach (Tile tile in map.GetTiles()) { if (tile is StartTile) { continue; } GComponent btn = UIPackage.CreateObject("Map", "MapBtn").asCom; GTile.AddChild(btn); btn.GetController("c1").selectedIndex = (int)tile.Type; btn.data = tile; btn.xy = Getpos(tile.X, tile.Y); if (btn.x + 300 > GTile.width) { GTile.width = btn.x + 300; } btn.onClick.Add(async() => { if (!map.CanMove(tile)) { return; } MainView.touchable = false; await btn.GetTransition("t0").PlayAsync(); MainView.touchable = true; map.MoveNext(tile); }); btn.onRightClick.Add(() => { //tile.ShowDeltaInfo(); }); if (tile is BossTile) { continue; } foreach (Tile next in tile.GetNexts()) { //Debug.Log("Connect" + tile.pos() + "," + next.pos()); ConnectRoom(Getpos(tile.X, tile.Y), Getpos(next.X, next.Y)); } } FreshMap(THClimbTower.EventType.FreshMap, map); //FreshCards(game.player.Deck); }
public void Show(GComponent parent) { if (parent != null) { parent.AddChild(SelfGComponent); } if (_backGraph == null) { _backGraph = new GGraph(); _backGraph.name = SelfGComponent.name + "_back"; _backGraph.DrawRect(GRoot.inst.width, GRoot.inst.height, 0, UnityEngine.Color.gray, new UnityEngine.Color(0, 0, 0, 0.7f)); _backGraph.AddRelation(GRoot.inst, RelationType.Size); _backGraph.onClick.Add(Close); } parent.AddChild(_backGraph); parent.AddChild(SelfGComponent); SelfGComponent.SetPivot(0.5f, 0.5f, true); SelfGComponent.SetScale(0.2f, 0.2f); SelfGComponent.SetXY(GRoot.inst.width * 0.5f, GRoot.inst.height * 0.5f); SelfGComponent.AddRelation(GRoot.inst, RelationType.Center_Center); SelfGComponent.AddRelation(GRoot.inst, RelationType.Middle_Middle); _curTween = Utils.TweenScale(SelfGComponent, Vector2.one, 0.2f); }
//加载房间列表 private void BattleButtonOnClick(GComponent targetComponent) { rooms = RoomManager.SearchRoom(rooms); //设置组件位置 targetComponent.SetXY(screenX / 2, 0); //移除模式选择组件,添加房间列表组件 mainComponent.RemoveChild(selectModeComponent); mainComponent.AddChild(targetComponent); //注册监听房间按钮,显示房间信息 roomList = targetComponent.GetChild("roomList").asList; roomList.SetVirtual(); roomList.itemRenderer = RenderListItem; //设置房间数目 roomList.numItems = rooms.Count; }
private void initChatBottom() { if (_te == null) { _chatBottom = UIPackage.CreateObjectFromURL("ui://BlueSkin/Chat1").asCom; _te = new TypingEffectByLine(_chatBottom.GetChild("title")); } if (_chatBottom.parent == null) { _popUp.AddChild(_chatBottom); } if (_chatBottom.visible == false) { _chatBottom.visible = true; } }
// Use this for initialization void Start() { GComponent gComponent = GetComponent <UIPanel>().ui; //Movie g_Time = gComponent.GetChild("Time").asMovieClip; g_Time.playing = false; //Road g_Road = new GImage[6]; g_Road[0] = gComponent.GetChild("Road1").asImage; g_Road[1] = gComponent.GetChild("Road2").asImage; g_Road[2] = gComponent.GetChild("Road3").asImage; g_Road[3] = gComponent.GetChild("Road4").asImage; g_Road[4] = gComponent.GetChild("Road5").asImage; g_Road[5] = gComponent.GetChild("Road6").asImage; //Role g_Player = gComponent.GetChild("PlayerRole").asImage; g_Enemy = gComponent.GetChild("EnemyRole").asImage; g_PlayerText = gComponent.GetChild("PlayerText").asTextField; g_EnemyText = gComponent.GetChild("EnemyText").asTextField; //Action g_Action = new GImage[8]; g_Action[0] = UIPackage.CreateObject("Game", "picMove").asImage; g_Action[1] = UIPackage.CreateObject("Game", "picAttack").asImage; g_Action[2] = UIPackage.CreateObject("Game", "picDefance").asImage; g_Action[3] = UIPackage.CreateObject("Game", "picMagic").asImage; g_Action[4] = UIPackage.CreateObject("Game", "picMove").asImage; g_Action[5] = UIPackage.CreateObject("Game", "picAttack").asImage; g_Action[6] = UIPackage.CreateObject("Game", "picDefance").asImage; g_Action[7] = UIPackage.CreateObject("Game", "picMagic").asImage; for (int i = 0; i < 8; ++i) { g_Action[i].height = 32; g_Action[i].width = 32; g_Action[i].visible = false; gComponent.AddChild(g_Action[i]); } //RoleAction g_PlayerAction = new int[10]; g_EnemyAction = new int[10]; }
/// <summary> /// 创建注册窗口 /// </summary> void AddRegisterFrame() { //禁用登陆UI registerFrame.GetChild("account").visible = true; mainUI.GetChild("Login").alpha = 0.6f; mainUI.GetChild("Login").touchable = false; mainUI.GetChild("addRegister").visible = false; mainUI.GetChild("GoButton").visible = false; login.GetChild("account").text = null; login.GetChild("password").text = null; //创建注册UI mainUI.AddChild(registerFrame); registerFrame.SetPosition(340, 100, 0); Transition t = registerFrame.GetTransition("t1"); t.Play(); }
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; }); }); }