Esempio n. 1
0
        void _onclickitem(EventContext eventContext)
        {
            GObject sdfsad = (GObject)eventContext.data;
            int     inda   = list.GetChildIndex(sdfsad);

            Debug.Log("" + inda);
        }
Esempio n. 2
0
//	void RenderComponents(int index, GObject obj){
//		GComponent item = obj.asCom;
//		item.visible = true;
//		GLoader icon = item.GetChild ("icon").asLoader;
//
//		TowerComponent tc = PlayerData.getInstance ().bagComponents [index];
//		if (tc == null) {
//			icon.url = "Equips/empty";
//		} else {
//			icon.url = "Equips/" + tc.cid;
//		}
//		item.onTouchEnd.Add (delegate() {
//			GameManager.getInstance().showDetailAmplifier(tc.cdesp);
//		});
//		item.draggable = true;
//
//		item.onDragStart.Set(delegate(EventContext context) {
//			context.PreventDefault();
//			DragDropManager.inst.StartDrag(item, "Equips/"+tc.cid, (object)(index), (int)context.data);
//			startDragBagItem(index);
//		});
//
//		//string name = PlayerData.getInstance ().bagComponents [index].cname;
//	}

//	void startDragBagItem(int idx){
//		beforeDragPos = tComponents.LocalToGlobal(tComponents.GetChildAt(idx).position);
//		isDropOnSlot = false;
//		//tComponents.GetChildAt(index).visible = false;
//		for (int i = idx+1; i < tComponents.numItems; i++) {
//			Vector2 startPos = tComponents.GetChildAt (i).position;
//			Vector2 endPos = tComponents.GetChildAt (i-1).position;
//			tComponents.GetChildAt (i).TweenMove (endPos,0.3f);
//		}
//		tComponents.RemoveChildAt(idx);
//		nowDragIdx = idx;
//		tComponents.EnsureBoundsCorrect ();
//	}


    void clickTower(EventContext context)
    {
        GComponent item = (GComponent)context.data;
        int        idx  = towers.GetChildIndex(item);

        towerIdx = idx;
        TowerTemplate tt = PlayerData.getInstance().ownedTowers[idx];

        for (int i = 0; i < 4; i++)
        {
            components [i].visible = true;
            if (tt.components [i] == null)
            {
                components[i].setInfo(null);
            }
            else
            {
                components[i].setInfo(tt.components[i]);
            }
        }
        _property.visible = true;
        updateCalcedProperty(tt);

        if (PlayerData.getInstance().guideStage == 14)
        {
            GuideManager.getInstance().showGuideCloseMenu();
            PlayerData.getInstance().guideStage = 15;
        }
    }
Esempio n. 3
0
 /// <summary>图书馆内卡牌的点击事件
 ///
 /// </summary>
 /// <param name="context"></param>
 public void OnClickCardInLibrary(EventContext context)
 {
     CardCollection.Instance().choosecardindex = onsalelist.GetChildIndex(context.data as GObject);
     CardCollection.Instance().choosecardID    = library_list[CardCollection.Instance().choosecardindex];
     verify_UI.Show();
     buybtn    = verify_UI.contentPane.GetChild("buybtn").asButton;
     cancelbtn = verify_UI.contentPane.GetChild("cancelbtn").asButton;
     buybtn.onClick.Add(BuyOnclick);
     cancelbtn.onClick.Add(CancelOnclick);
 }
Esempio n. 4
0
        //鼠标事件 add by tianjinpeng 2018/03/09 15:30:43
        void onclick(EventContext eventContext)
        {
            GObject sdfsad = (GObject)eventContext.data;
            int     inda   = baglist.GetChildIndex(sdfsad);

            leftright = 1;
            indexshuan(inda);
            onoff(1);

            //indexshuan(inda);
            //openchoice();

            Debug.Log("" + inda);
        }
Esempio n. 5
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    public bool RemoveItem(string name)
    {
        GComponent item = _list.GetChild(name).asCom;

        if (item != null)
        {
            int index = _list.GetChildIndex(item);
            _list.RemoveChildToPoolAt(index);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 6
0
        /// <summary>
        /// 响应卡牌书内卡牌点击事件
        /// </summary>
        /// <param name="context"></param>
        public void OnClickCardInCardCollection(EventContext context)
        {
            // 先获取到点击的下标
            int index = cardcollectionlist.GetChildIndex(context.data as GObject);

            // 通过下标获取到id
            string cardId = playercardlist[index];
            // 向数据库查询展示数据
            JsonData data = CardManager.Instance().GetCardJsonData(cardId);

            _abstractText.text = "姓名:" + data["name"] + "\n" + "类型:" + data["type"];

            _storyText.text = "这里本来该有卡牌故事但是现在没有数据\n" + data["effect"];

            // TODO: 根据策划案加载icon

            _picLoader.url = UIPackage.GetItemURL(cardicons, cardId);
        }
    /// <summary>
    /// 响应卡牌堆内卡牌点击事件的函数
    /// </summary>
    /// <param name="context"></param>
    public void OnClickCardInCardSets(EventContext context)
    {
        // 先获取到点击的下标
        int index = _cardsSetsList.GetChildIndex(context.data as GObject);

        // 通过下标获取到id
        string cardId = cardSetsList[index];

        // 测试,直接把卡牌放入手牌中
        CardManager.Instance().InsertIntoHandCard(cardId);


        // 向数据库查询展示数据
        JsonData data = CardManager.Instance().GetCardJsonData(cardId);

        _abstractText.text = "姓名:" + data["name"] + "\n" + "类型:" + data["type"];

        _storyText.text = "这里本来该有卡牌故事但是现在没有数据\n" + data["effect"];

        // TODO: 根据策划案加载icon

        _picLoader.url = UIPackage.GetItemURL(cardBookPicAssets, cardId);
    }
    /// <summary>
    /// 响应手牌点击事件的函数
    /// </summary>
    public void OnClickHandCard(EventContext context)
    {
        // 如果不是玩家回合,则无法使用卡牌
        if (!Gameplay.Instance().roundProcessController.IsPlayerRound())
        {
            return;
        }

//		int index = _handcardList.GetChildIndex(context.data as GObject);
//		BaseCard baseCardReference = handcardInstanceList[index].GetComponent<BaseCard>();
//		if (!Player.Instance().CanConsumeAp(baseCardReference.cost))
//		{
//			Debug.Log("Ran out of AP, cant use this one");
//			return;
//		}

        GObject item = context.data as GObject;

        // 确认当前点击的卡牌和上次点击的不同,此时表明用户想使用这张卡牌
        if (item != lastClicked)
        {
            // 改变记录
            lastClicked = item;
            // 动效
            //DoSpecialEffect(item);
            // 设置当前选中的卡牌
            CardManager.Instance().SetSelectingCard(_handcardList.GetChildIndex(item));
        }
        else         // 此时用户点击的牌和上次相同,表示用户想取消使用
        {
            // 恢复原大小
            foreach (GObject litem in _handcardList.GetChildren())
            {
                StartCoroutine(FancyHandCardEffect(litem, 1));
            }

            // 重置上次选择项
            lastClicked = null;

            // 调用取消使用方法
            CardManager.Instance().CancleUseCurrentCard();

            // 结束函数执行,因为用户取消使用
            return;
        }

        CardManager.Instance().OnUseCurrentCard();

//		// 若是效果牌
//		if (baseCardReference.type.Equals("Order"))
//		{
////			// 判断使用结果
////			if (baseCardReference.Use())
////			{
////				// 使用成功则移除手牌
////				CardManager.Instance().RemoveCardToCd(index);
////				return;
////			}
//
//			baseCardReference.Use();
//
//		}
//		else
//		{
//			if (Gameplay.Instance().gamePlayInput.IsSelectingCard == false)
//			{
//				Gameplay.Instance().gamePlayInput. OnPointerDownUnitCard(handcardInstanceList[index]);
//				BattleMap.BattleMap.Instance().IsColor = true;
//			}
//		}
    }