Ejemplo n.º 1
0
    override public bool Init(ObjectInitParam param)
    {
        PickInitParam pickParam = (PickInitParam)param;

        if (!DataManager.PickTable.ContainsKey(pickParam.pick_res_id))
        {
            GameDebug.LogError("pick表中不存在ID: " + pickParam.pick_res_id);
            return(false);
        }

        mRes        = DataManager.PickTable[pickParam.pick_res_id] as PickTableItem;
        mModelResID = mRes.modelId;
        mContent    = pickParam.content;
        mPickType   = pickParam.pick_type;
        mFlyType    = pickParam.fly_type;
        mRandomPos  = pickParam.random_pos;

        if (!base.Init(param))
        {
            return(false);
        }

        InitProperty();

        return(true);
    }
Ejemplo n.º 2
0
    public override void OnPick(ObjectBase pick, ObjectBase picker)
    {
        base.OnPick(pick, picker);

        if (pick == null || picker == null)
        {
            return;
        }

        Pick obj = pick as Pick;

        if (obj == null)
        {
            return;
        }

        PickTableItem pti = obj.GetCurPickTableItem();

        if (pti == null)
        {
            return;
        }

        if (pick.GetAlias() == "pick_buff")
        {
            ModuleManager.Instance.FindModule <MonsterFloodModule>().TempMoney -= 50;
            GameDebug.Log("拾取pick_buff:" + pti.resID);
            RemoveObjsByAlias <Pick>(MonsterFloodModule.Pick_Buff);
            BattleUIEvent bu4 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_PICK_TEMPMONEY);
            bu4.msg = pick.GetPosition();
            EventSystem.Instance.PushEvent(bu4);
        }
    }
Ejemplo n.º 3
0
	public override void OnPick(ObjectBase pick, ObjectBase picker)
	{
		base.OnPick (pick, picker);

        if (pick == null || picker == null)
            return;

        Pick obj = pick as Pick;

        if (obj == null)
            return;

        PickTableItem pti = obj.GetCurPickTableItem();
        if (pti == null)
            return;

		if (!ObjectType.IsPlayer(picker.Type))
			return;

		if (pti.resID == mGoldId1 || pti.resID == mGoldId2 || pti.resID == mGoldId3)
		{
			if (mCurPickCount >= mMaxPickCount)
				return;

			mCurPickCount++;

			MaoStageUpdateGoldEvent eUI = new MaoStageUpdateGoldEvent();
			eUI.CurrentGold = mCurPickCount;
			eUI.TotalGold = mMaxPickCount;
			eUI.PickPos = obj.GetPosition();
			EventSystem.Instance.PushEvent(eUI);

			if (mCurPickCount >= mMaxPickCount)
			{
				EventSystem.Instance.PushEvent(new MaoStageSucceedEvent());
			}
		}
		else
		{
			FindPickEvent e = new FindPickEvent();
			e.OwnerId = (int)picker.InstanceID;
			e.PickResId = pti.resID;
			e.Position = obj.GetPosition();
			EventSystem.Instance.PushEvent(e);
		}
    }
Ejemplo n.º 4
0
    public override void OnPick(ObjectBase pick, ObjectBase picker)
    {
        base.OnPick(pick, picker);

        if (pick == null || picker == null)
        {
            return;
        }

        Pick obj = pick as Pick;

        if (obj == null)
        {
            return;
        }

        PickTableItem pti = obj.GetCurPickTableItem();

        if (pti == null)
        {
            return;
        }

        //switch(pti.resID)
        //{
        //    case 5:             //齿轮碎片;
        //        BattleUIEvent bue1 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_PICK_GEAR);
        //        bue1.msg = pick.GetPosition();
        //        EventSystem.Instance.PushEvent(bue1);
        //        break;
        //    case 3:             //捡到金币;
        //        BattleUIEvent bue2 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_PICK_GOLD);
        //        bue2.msg = pick.GetPosition();
        //        EventSystem.Instance.PushEvent(bue2);
        //        break;
        //}
        int pickId = (int)ConfigManager.GetVal <int>(ConfigItemKey.ZOMBIE_PICK_ID);

        //Debug.LogError(pti.resID);
        if (pti.resID == pickId)
        {
            BattleUIEvent bue1 = new BattleUIEvent(BattleUIEvent.BATTLE_UI_ZOMBIE_PICK1);
            //bue1.msg = pick.GetPosition();
            EventSystem.Instance.PushEvent(bue1);
        }
    }