Exemple #1
0
    protected void RegisterSubscriber()
    {
        _mLeaveBattle         = EventManager.Subscribe(BattleStatusPublisher.NAME + ":" + BattleStatusPublisher.EVENT_LEAVE_BATTLE);
        _mLeaveBattle.Handler = delegate(object[] args)
        {
            GameData.BattleGameData.BattleResult result = (GameData.BattleGameData.BattleResult)args[0];
            // OnBattleEnd(result);
        };

        // When a new formation is applied, then change the new Model
        _mFormationApplySub         = EventManager.Subscribe(NetReceiverPublisher.NAME + ":" + NetReceiverPublisher.EVENT_FORMATION_APPLY);
        _mFormationApplySub.Handler = delegate(object[] args)
        {
            int error = (int)args[0];
            if (error != (int)PacketErrorCode.SUCCESS)
            {
                return;
            }

            if (GameStatusManager.Instance.MGameState == GameState.GAME_STATE_COPY)
            {
//				ReplaceActorModel();
            }
        };
    }
    public void OnOnceBattleEnd(GameData.BattleGameData.BattleResult battleResult, GameObject fightMonsterObj)
    {
        Vector3 monsterPos = Vector3.zero;

        switch (battleResult.BattleWinResult)
        {
        case GameData.BattleGameData.EBattleWinResult.ACTOR_WIN:
        case GameData.BattleGameData.EBattleWinResult.DOGFALL:         // Dogfall
        {
            monsterPos = fightMonsterObj.transform.position;
            DestroyMonster(fightMonsterObj);
            break;
        }

        case GameData.BattleGameData.EBattleWinResult.MONSTER_WIN:
        {
            // Direct back to orignal
            actor.transform.position     = actorStartPoint;
            sceneRoot.transform.position = mBackgroundInitPos;

            mActorMoving = false;
            mSceneMoving = false;
            break;
        }
        }

        HideMovableObjs(false);
        if (battleResult.IsFinalBattle)
        {
            HideWebwayGates(false, monsterPos);
        }
    }
    public override void OnBattleEnd(GameData.BattleGameData.BattleResult battleResult)
    {
//		//if(battleResult.BattleWinResult == GameData.BattleGameData.EBattleWinResult.ACTOR_WIN // is win
//		//	&& Globals.Instance.MGameDataManager.MCurrentCopyData.MCopyBasicData.CopyType == 2 // boss type
//		//	&& StageCopy.GetMonsterCount() == 1){ // finall monster
//		//	OnBattleEnd_impl(battleResult);
//		//}else{
//		//	OnBattleEnd_impl(battleResult);
//		//}

        OnBattleEnd_impl(battleResult);
        _mPublisher.NotifyNPCFleetCount(StageCopy.GetMonsterCount());
    }
Exemple #4
0
    public void PlaySneakEffect(GameData.BattleGameData.BattleResult battleResult, EffectEndDelegate endDel)
    {
        NewEffectFont.EffectType type;
        if (battleResult.SneakAttackType == GameData.BattleGameData.SneakAttackType.ROLE_ATTACK)
        {
            type = NewEffectFont.EffectType.TouXiChengGong;
            Globals.Instance.MSoundManager.PlaySoundEffect("Sounds/UISounds/BattleWin");
        }
        else if (battleResult.SneakAttackType == GameData.BattleGameData.SneakAttackType.NPC_ATTACK)
        {
            type = NewEffectFont.EffectType.BeiTouXi;
            Globals.Instance.MSoundManager.PlaySoundEffect("Sounds/UISounds/BattleFail");
        }
        else
        {
            return;
        }

        NewEffectFont.Show(type, endDel);
    }
Exemple #5
0
    public void PlayBattleEffect(GameData.BattleGameData.BattleResult battleResult, EffectEndDelegate endDel)
    {
        NewEffectFont.EffectType type;
        if (battleResult.BattleWinResult == GameData.BattleGameData.EBattleWinResult.ACTOR_WIN)
        {
            type = NewEffectFont.EffectType.ZhanDouShengLi;
            Globals.Instance.MSoundManager.PlaySoundEffect("Sounds/UISounds/BattleWin");
        }
        else if (battleResult.BattleWinResult == GameData.BattleGameData.EBattleWinResult.MONSTER_WIN)
        {
            type = NewEffectFont.EffectType.ZhanDouShiBai;
            Globals.Instance.MSoundManager.PlaySoundEffect("Sounds/UISounds/BattleFail");
        }
        else
        {
            type = NewEffectFont.EffectType.ZhanDouPingJu;
            Globals.Instance.MSoundManager.PlaySoundEffect("Sounds/UISounds/BattleDraw");
        }

        NewEffectFont.Show(type, endDel);
    }
Exemple #6
0
    public virtual void OnBattleEnd(GameData.BattleGameData.BattleResult battleResult)
    {
        if (battleResult.BattleWinResult == GameData.BattleGameData.EBattleWinResult.ACTOR_WIN &&     // is win
            Globals.Instance.MGameDataManager.MCurrentCopyData.MCopyBasicData.CopyType == 2 &&             // boss type
            _mMonsterFleetList.Count == 1)                 // finall monster

        // fade in copy scene
        // SceneFadeInOut.Instance.FadeInScene(3);

        {
            CreateCutscene("TempArtist/Animation/DefeatBoss", delegate(Cutscenes _cutscenes){
                OnBattleEnd_impl(battleResult);
                // SceneFadeInOut.Instance.FadeInScene(3);
            });
        }
        else
        {
            OnBattleEnd_impl(battleResult);
        }
        _mPublisher.NotifyNPCFleetCount(_mMonsterFleetList.Count);
    }
Exemple #7
0
    /**
     * tzz added
     * fill enemy player data by BattleResult it has been used by NetReceiver.cs and TeachFirstEnterGame.cs
     *
     * @param newBattleResult		battle result data
     */
    public void FillEnemyPlayerData(GameData.BattleGameData.BattleResult newBattleResult)
    {
        if (MActorData == null || MEnemyData == null)
        {
            throw new System.Exception("MActorData == null || MEnemyData == null");
        }

        // Fill in enemy PlayerData
        PlayerData playerData = null;

        foreach (GameData.BattleGameData.Fleet fleetData in newBattleResult.Fleets)
        {
            // by lsj
            if (newBattleResult.BattleType == GameData.BattleGameData.BattleType.PORT_VIE_BATTLE &&
                Globals.Instance.MPortVieManager.puFlagReverseFleetPosition)
            {
                if (fleetData.IsAttacker)
                {
                    playerData = MEnemyData;
                    playerData.ClearWarshipDatas();
                }
                else
                {
                    playerData = MActorData;
                }
            }
            else
            {
                if (fleetData.IsAttacker)
                {
                    playerData = MActorData;
                }
                else
                {
                    playerData = MEnemyData;
                    playerData.ClearWarshipDatas();
                }
            }

            List <GameData.BattleGameData.Ship> shipDatas = fleetData.Ships;
            foreach (GameData.BattleGameData.Ship shipData in shipDatas)
            {
                GirlData data = playerData.GetGirlData(shipData.ShipID);
                if (null == data)
                {
                    data            = new GirlData();
                    data.roleCardId = shipData.ShipID;
//					data.BasicData.LogicID = shipData.LogicShipID;

                    playerData.AddWarshipData(shipData.ShipID, data);
                }
                else
                {
                    data.roleCardId = shipData.ShipID;
//					data.BasicData.LogicID = shipData.LogicShipID;
                }

                // Is Npc ship
//				data.BasicData.IsNpc = shipData.IsNpc;

//				data.BasicData.Name = shipData.ShipName;
//				data.BasicData.TypeID = (EWarshipTypeID)shipData.TypeID;
//				switch (data.BasicData.TypeID)
//				{
//				case EWarshipTypeID.AIRCRAFT_CARRIER:
//					data.BasicData.Type = EWarshipType.CARRIER;
//					break;
//				case EWarshipTypeID.SURFACE_CRAFT:
//				case EWarshipTypeID.SURFACE_CRAFT_1:
//				case EWarshipTypeID.SURFACE_CRAFT_2:
//				case EWarshipTypeID.SURFACE_CRAFT_3:
//				case EWarshipTypeID.SURFACE_CRAFT_4:
//				case EWarshipTypeID.SURFACE_CRAFT_5:
//				case EWarshipTypeID.SURFACE_CRAFT_6:
//					data.BasicData.Type = EWarshipType.SURFACE_SHIP;
//					break;
//				case EWarshipTypeID.UNDER_WATER_CRAFT:
//					data.BasicData.Type = EWarshipType.SUBMARINE;
//					break;
//				}
//				data.BasicData.FillDataFromConfig();

                data.PropertyData.Life = shipData.InitialCurrentLife;
                //data.PropertyData.MaxLife = shipData.MaxLife;
                data.PropertyData.Power    = 0;
                data.PropertyData.MaxPower = GirlData.MAX_POWSER;
            }
        }
    }
Exemple #8
0
    protected virtual void OnBattleEnd_impl(GameData.BattleGameData.BattleResult battleResult)
    {
        // Resume the camera
        Globals.Instance.MSceneManager.mMainCamera.transform.position = _mCurrentCamPos;
        Globals.Instance.MSceneManager.mMainCamera.transform.forward  = _mCurrentCamForward;

        // resume trigger battle, and close Input
        SetEnabled(true);
        SetFingerEventActive(true);
        _mIsPermitRequestBattle = true;

        // Clear ReinforcementData
        Globals.Instance.MGameDataManager.MActorData.RemoveReinforcementData();

        Vector3 monsterPos = Vector3.zero;

        switch (battleResult.BattleWinResult)
        {
        // Actor win
        case GameData.BattleGameData.EBattleWinResult.ACTOR_WIN:
        {
            // Destroy the guide
            DestroyGuideArrows(_mFightingMonsterFleet);

            // Destroy the failed Fleet according to BattleResult
            monsterPos = _mFightingMonsterFleet.Position;
            _mMonsterFleetList.Remove(_mFightingMonsterFleet);
            Globals.Instance.MPlayerManager.RemoveMonsterFleet(_mFightingMonsterFleet);
            _mFightingMonsterFleet = null;

            // Create a random chest
            if (battleResult.ChestID != -1)
            {
                GameObject go = CreateRandomChest(battleResult.ChestID);
                go.transform.position = monsterPos;
            }

            // Single Drap information
            OnceBattleFinish();

            break;
        }

        // Dogfall
        case GameData.BattleGameData.EBattleWinResult.DOGFALL:
        {
            // Destroy the guide
            DestroyGuideArrows(_mFightingMonsterFleet);

            // Destroy the failed Fleet according to BattleResult
            monsterPos = _mFightingMonsterFleet.Position;
            _mMonsterFleetList.Remove(_mFightingMonsterFleet);
            Globals.Instance.MPlayerManager.RemoveMonsterFleet(_mFightingMonsterFleet);
            _mFightingMonsterFleet = null;

            // Create a random chest
            if (battleResult.ChestID != -1)
            {
                GameObject go = CreateRandomChest(battleResult.ChestID);
                go.transform.position = monsterPos;
            }
            break;
        }

        // Monster win
        case GameData.BattleGameData.EBattleWinResult.MONSTER_WIN:
        {
            // tzz added
            // move the warship by monster collider bounds to avoid the fight immedately again
            //
            Vector3 t_monsterSize = _mFightingMonsterFleet.m_battleTrigger.GetComponent <Collider>().bounds.size;

            // increase some distance
            t_monsterSize.x += 50;

            // get the own actor ship position
            Vector3 t_ownPos = Vector3.zero;
            foreach (WarshipL ws in _mActorFleet._mWarshipList)
            {
                t_ownPos = ws.U3DGameObject.transform.position;
                break;
            }

            // monster(Enemy) position
            Vector3 t_monsterPos = _mFightingMonsterFleet.m_copyStatusGameObject.transform.position;

            // actor direct back position
            Vector3 t_direclyBackPos = t_monsterPos + ((t_ownPos - t_monsterPos).normalized * t_monsterSize.x);

            Vector2[] t_restPos =
            {
                new Vector2(t_direclyBackPos.x,               t_direclyBackPos.z),
                new Vector2(t_monsterPos.x + t_monsterSize.x, t_monsterPos.z),
                new Vector2(t_monsterPos.x - t_monsterSize.x, t_monsterPos.z),
                new Vector2(t_monsterPos.x,                   t_monsterPos.z + t_monsterSize.x),
                new Vector2(t_monsterPos.x,                   t_monsterPos.z - t_monsterSize.x),
            };

            foreach (Vector2 pos in t_restPos)
            {
                if (crossArea.Contains(pos))
                {
                    // rest position is in the cross Area
                    //
                    foreach (WarshipL ws in _mActorFleet._mWarshipList)
                    {
                        ws.ForceMoveTo(new Vector3(pos.x, t_ownPos.y, pos.y));
                    }
                    break;
                }
            }

            Statistics.INSTANCE.CustomEventCall(Statistics.CustomEventType.FailedCopyBattle, "CopyID", Globals.Instance.MGameDataManager.MCurrentCopyData.MCopyBasicData.CopyID);
            break;
        }
        }

        // Flush ship life
        Dictionary <long, GirlData> dictWarshipData = Globals.Instance.MGameDataManager.MActorData.GetWarshipDataList();
        List <GameData.BattleGameData.WarshipBattleEndCurrLife> listWarshipLife = GameStatusManager.Instance.MBattleStatus.MBattleResult.ListWarshipBattleEndCurrLife;

        foreach (GameData.BattleGameData.WarshipBattleEndCurrLife warshipLife in listWarshipLife)
        {
            if (dictWarshipData.ContainsKey(warshipLife.ShipID))
            {
                dictWarshipData[warshipLife.ShipID].PropertyData.Life = warshipLife.ShipCurrLife;
            }
        }

//		Globals.Instance.MGameDataManager.MActorData.NotifyWarshipUpdate();
        Debug.Log("copystatas");
        Globals.Instance.M3DItemManager.PlayBattleEffect(battleResult, delegate(){
            Globals.Instance.MGUIManager.CreateWindow <GUISingleDrop>(delegate(GUISingleDrop gui)
            {
                gui.UpdateData();
            });
        });

        if (battleResult.IsFinalBattle)
        {
            _mIsFinalBattle = true;

            GameObject       go      = GraphicsTools.ManualCreateObject("TempArtist/Prefab/Particle/S_LeaveCopy", "LeaveTrigger", false);
            float            y       = go.transform.position.y;
            LeaveCopyTrigger trigger = go.AddComponent <LeaveCopyTrigger>() as LeaveCopyTrigger;
            go.transform.position   = new Vector3(monsterPos.x, y, monsterPos.z);
            go.transform.localScale = Vector3.one;
            mLeaveTrigger           = go.transform.position;
            // DisplayCopyDrops();
        }
    }
    protected override void OnBattleEnd_impl(GameData.BattleGameData.BattleResult battleResult)
    {
        _mIsPermitRequestBattle = true;

        // Clear ReinforcementData
        Globals.Instance.MGameDataManager.MActorData.RemoveReinforcementData();

        switch (battleResult.BattleWinResult)
        {
        // Actor win
        case GameData.BattleGameData.EBattleWinResult.ACTOR_WIN:
        case GameData.BattleGameData.EBattleWinResult.DOGFALL:         // Dogfall
        {
            OnceBattleFinish();
            break;
        }

        // Monster win
        case GameData.BattleGameData.EBattleWinResult.MONSTER_WIN:
        {
            Statistics.INSTANCE.CustomEventCall(Statistics.CustomEventType.FailedCopyBattle, "CopyID", Globals.Instance.MGameDataManager.MCurrentCopyData.MCopyBasicData.CopyID);
            break;
        }
        }

        // Flush ship life
        Dictionary <long, GirlData> dictWarshipData = Globals.Instance.MGameDataManager.MActorData.GetWarshipDataList();
        List <GameData.BattleGameData.WarshipBattleEndCurrLife> listWarshipLife = GameStatusManager.Instance.MBattleStatus.MBattleResult.ListWarshipBattleEndCurrLife;

        foreach (GameData.BattleGameData.WarshipBattleEndCurrLife warshipLife in listWarshipLife)
        {
            if (dictWarshipData.ContainsKey(warshipLife.ShipID))
            {
                dictWarshipData[warshipLife.ShipID].PropertyData.Life = warshipLife.ShipCurrLife;
            }
        }

        // Play battle result effect
        Globals.Instance.M3DItemManager.PlayBattleEffect(battleResult, delegate()
        {
            // Monster win, give the user a good tooltips
            if (battleResult.BattleWinResult == GameData.BattleGameData.EBattleWinResult.MONSTER_WIN)
            {
                // Move the BattleFailedProcess prompt to here
                GameStatusManager.Instance.MBattleStatus.BattleFailedProcess();
            }
            else
            {
                Globals.Instance.MGUIManager.CreateWindow <GUISingleDrop>(delegate(GUISingleDrop gui)
                {
                    gui.UpdateData();
                });
            }
        });

        // Handle the 2d stage logic
        StageCopy.OnOnceBattleEnd(battleResult, fightingMonster);

        // Request update the GUIMain ships blood
        Globals.Instance.MGameDataManager.MActorData.NotifyWarshipUpdate();

        _mIsFinalBattle = battleResult.IsFinalBattle;
        fightingMonster = null;
    }
 public void NotifyLeaveBattle(GameData.BattleGameData.BattleResult result)
 {
     base.Notify(EVENT_LEAVE_BATTLE, result);
 }