Пример #1
0
    void OnTriggerEnter(Collider collider)
    {
        if (!stayAway.level.Equals(LogicManager.Instance.tempLevel.level))
        {
            return;
        }
        Character character = collider.GetComponent <Character>();

        if (character != null)
        {
            Debug.Log("Center Enter" + transform.parent.name);
            MessageEventArgs msg = new MessageEventArgs();
            msg.AddMessage("message", message);
            if (isItem)
            {
                msg.AddMessage("type", Global.ITEM);
            }
            if (isPerson)
            {
                msg.AddMessage("type", Global.PERSON);
            }
            msg.AddMessage("process", process.ToString());
            BEventManager.Instance.PostEvent(EventDefine.OnEnterCenter, this, msg);
        }
    }
Пример #2
0
    IEnumerator UpdateEnterProcess()
    {
        yield return(new WaitForSeconds(enterTime));

        while (true)
        {
            if (tempSenserable == null)
            {
                yield break;
            }

//			Vector3 deltaPosition = tempSenserable.transform.position - lastSensablePosition;
//			lastSensablePosition = tempSenserable.transform.position;

            // get the enterProcess
//			enterProcess += GetDeltaEnterProcess( deltaPosition );
            enterProcess = GetEnterProcess();

            MessageEventArgs msg = new MessageEventArgs();
            msg.AddMessage("AwayDistance", GetAwayDistance(enterProcess).ToString());
            msg.AddMessage("CenterPosition", transform.position.ToString());
            msg.AddMessage("Level", level);
            BEventManager.Instance.PostEvent(EventDefine.UpdateStayAway, this.gameObject
                                             , msg);
//			Debug.Log( "From " + name +  " EnterProcess" + enterProcess.ToString());
            if (ifEndProcess(enterProcess))
            {
                SensableOut();
                yield break;
            }
            yield return(null);
        }
    }
Пример #3
0
    /*UI CALLBACK*/
    public void EnterBattle(int battleType)
    {
        MessageEventArgs arg = new MessageEventArgs();
        arg.AddMessage("WindowID", UIWindowID.BattleWindow);
        EventManager.Instance.PostEvent(UIEvent.OpenUIWindow, arg);

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("BattleType",battleType);
        if(battleType == 0)
        {
            args.AddMessage("Man",true);
            args.AddMessage("Girl",true);
            args.AddMessage("Enemy",new int[3]{101,102,103});
        }
        else if(battleType == 1)
        {
            args.AddMessage("Man",true);
            args.AddMessage("Girl",true);
            args.AddMessage("Enemy",new int[1]{104});
        }
        else
        {
            args.AddMessage("Man",true);
            args.AddMessage("Enemy",new int[1]{105});
        }
        EventManager.Instance.PostEvent (BattleEvent.OnBattleEnter, args);
    }
Пример #4
0
    public void OnChange()
    {
        MessageEventArgs msg = new MessageEventArgs();

        msg.AddMessage("text", input.value);
        BEventManager.Instance.PostEvent(EventDefine.OnChangeInput, msg);
    }
Пример #5
0
 void OnItemClicked(MessageEventArgs args)
 {
     int itemID = args.GetMessage<int>("ItemID");
     ItemData itemData = DataManager.Instance.GetItemDataSet().GetItemData(itemID);
     args.AddMessage ("Message", itemData.description);
     EventManager.Instance.PostEvent (UIEvent.OnMessageSet, args);
 }
    protected override void Init()
    {
        source.timelinePosition = 0;

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}被<击倒>了!", source.GetName()));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffActivated, args);
    }
    protected override void Execute()
    {
        source.damageTaken.interrupt = 0;

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}因为<霸体>,没有被击退!", source.GetName()));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffActivated, args);
    }
    protected override void Revert()
    {
        source.buffFrozenTime = 0;

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}不再<冰冻>了!", source.GetName()));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffDeactivated, args);
    }
    protected override void Init()
    {
        source.buffFrozenTime = 5;

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}因为<冰冻>,暂时不能行动!", source.GetName()));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffActivated, args);
    }
 protected override void Execute()
 {
     source.damageTaken.dmg = 0;
     source.damageTaken.interrupt = 0;
     MessageEventArgs args = new MessageEventArgs ();
     args.AddMessage("Message",string.Format("{0}因为<祝福>,完全抵御了此次伤害!", source.GetName()));
     EventManager.Instance.PostEvent (BattleEvent.OnBuffActivated, args);
     source.buffList.Remove(this);
 }
Пример #11
0
 void OnTriggerEnter( Collider collider )
 {
     if ( !stayAway.level.Equals(LogicManager.Instance.tempLevel.level ) )
         return;
     Character character = collider.GetComponent<Character>();
     if ( character != null )
     {
         Debug.Log("Center Enter" + transform.parent.name );
         MessageEventArgs msg = new MessageEventArgs();
         msg.AddMessage("message" , message );
         if ( isItem )
             msg.AddMessage("type" , Global.ITEM);
         if ( isPerson )
             msg.AddMessage("type" , Global.PERSON );
         msg.AddMessage("process" , process.ToString());
         BEventManager.Instance.PostEvent( EventDefine.OnEnterCenter , this , msg );
     }
 }
    public void OnExitButtonClick()
    {
        this.gameObject.SetActive(false);

        DataManager.Instance.UnLoadAllData();

        MessageEventArgs arg = new MessageEventArgs();
        arg.AddMessage("WindowID", UIWindowID.IntroWindow);
        EventManager.Instance.PostEvent(UIEvent.OpenUIWindow, arg);
    }
Пример #13
0
 protected override void Revert()
 {
     if(source.GetBattleType() != BattleType.Physical)
     {
         source.maxHPMulti += 0.5f;
         MessageEventArgs args = new MessageEventArgs ();
         args.AddMessage("Message",string.Format("{0}不再<气虚>了!", source.GetName()));
         EventManager.Instance.PostEvent (BattleEvent.OnBuffDeactivated, args);
     }
 }
Пример #14
0
    protected override void Execute()
    {
        poisonTurns++;
        int previousHP = source.currentHP;
        source.currentHP -= Mathf.RoundToInt(source.maxHP * poisonTurns * 0.05f);

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}因为<中毒>,失去了{1}点生命!", source.GetName(), previousHP - source.currentHP));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffActivated, args);
    }
    protected override void Revert()
    {
        source.attackMulti -= 0.2f;
        source.defenceMulti -= 0.2f;
        source.speedMulti -= 0.2f;

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}不再<激昂>了!", source.GetName()));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffDeactivated, args);
    }
Пример #16
0
    public void OnLeaderButtonClick()
    {
        configData.currentLeaderID = 1 - configData.currentLeaderID;// 0->1, 1->0
        leaderButton.image.sprite = Resources.Load(GlobalDataStructure.PATH_UIIMAGE_BATTLE + "Avatar0" + configData.currentLeaderID, typeof(Sprite)) as Sprite;
        SaveManager.Instance.SaveConfig();

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("LeaderID",configData.currentLeaderID);
        EventManager.Instance.PostEvent(UIEvent.OnSwitchLeader, args);
    }
Пример #17
0
    virtual protected void OnSensableEnter(Sensable _senserable)
    {
        Debug.Log("On Enter");
        tempSenserable = _senserable;
        StartCoroutine(UpdateEnterProcess());

        MessageEventArgs msg = new MessageEventArgs();

        msg.AddMessage("Level", level);
        BEventManager.Instance.PostEvent(EventDefine.EnterStayAway, this.gameObject, msg);
    }
    protected override void Revert()
    {
        source.accuracyMulti += 0.25f;
        source.evasionMulti += 0.25f;
        source.critMulti += 0.25f;
        source.critResistMulti += 0.25f;

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",string.Format("{0}不再<麻痹>了!", source.GetName()));
        EventManager.Instance.PostEvent (BattleEvent.OnBuffDeactivated, args);
    }
Пример #19
0
    virtual protected void SensableOut()
    {
        tempSenserable.transform.parent = LogicManager.Instance.tempLevel.transform;
        tempSenserable = null;

        MessageEventArgs msg = new MessageEventArgs();

        msg.AddMessage("Level", level);
        BEventManager.Instance.PostEvent(EventDefine.ExitStayAway);
//		enterProcess = -0.01f;
        StopCoroutine(UpdateEnterProcess());
    }
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);
        Application.runInBackground = false;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        DataManager.Instance.LoadConfig();

        UIManager.Instance.PreloadWindow();
        MessageEventArgs args = new MessageEventArgs();
        args.AddMessage("WindowID", UIWindowID.IntroWindow);
        EventManager.Instance.PostEvent(UIEvent.OpenUIWindow, args);
    }
    IEnumerator LoadMainContent()
    {
        GlobalManager.Instance.gameStatus = GameStatus.Loading;
        DataManager.Instance.LoadAllData ();

        yield return new WaitForSeconds(1);

        MessageEventArgs args = new MessageEventArgs();
        args.AddMessage("WindowID", UIWindowID.MapWindow);
        EventManager.Instance.PostEvent(UIEvent.OpenUIWindow, args);

        GlobalManager.Instance.gameStatus = GameStatus.Map;
    }
Пример #22
0
 void PlayNextText()
 {
     text.DOKill();
     text.text = "";
     if(currentPlaying < content.Length)
     {
         text.DOText(content[currentPlaying], 5).SetEase(Ease.Linear).SetDelay(1);
         currentPlaying++;
     }
     else
     {
         MessageEventArgs args = new MessageEventArgs();
         args.AddMessage("WindowID", UIWindowID.LoadingWindow);
         EventManager.Instance.PostEvent(UIEvent.OpenUIWindow, args);
     }
 }
Пример #23
0
    protected override void Execute()
    {
        source.currentHP = 1;
        source.timelinePosition = -10000;
        source.ClearBuff();
        source.isBlocking = false;
        source.isEvading = false;
        source.battleStatus = BattleStatus.Prepare;
        if(source.guardedTarget != null)
        {
            source.guardedTarget.guardTarget = null;
            source.guardedTarget = null;
        }

        MessageEventArgs args = new MessageEventArgs ();
        args.AddMessage("Message",source.GetName() + "因为<灵气体质>,复活了!");
        EventManager.Instance.PostEvent (BattleEvent.OnBuffActivated, args);
    }
Пример #24
0
    public void Init(int playerID)
    {
        data = DataManager.Instance.GetPlayerDataSet().GetPlayerData(playerID).Clone();
        playerData = data as PlayerData;

        UIEvent = this.GetComponent<BattleObjectUIEvent>();
        UIEvent.Init(playerID);
        UIEvent.InitHPBar(maxHP, data.battleType);
        currentHP = maxHP;

        MessageEventArgs args = new MessageEventArgs();
        args.AddMessage("Object", this);
        EventManager.Instance.PostEvent(BattleEvent.OnPlayerSpawn, args);

        for(int i = 0; i < data.bornBuffs.Count; i++)
        {
            AddBuff(data.bornBuffs[i], -1);//添加固有BUFF
        }
        SkillHelper.CheckWeaponBuff(this);
    }
Пример #25
0
    public void Init(int enemyID)
    {
        data = DataManager.Instance.GetEnemyDataSet ().GetEnemyData (enemyID).Clone();
        enemyData = data as EnemyData;
        isEnemy = true;

        UIEvent = this.GetComponent<BattleObjectUIEvent>();
        UIEvent.Init(enemyData.imageID);
        UIEvent.InitEnemyHPBar(maxHP, data.battleType);
        currentHP = maxHP;

        AI = this.GetComponent<EnemyAI>();
        AI.InitAI(enemyData.aiID);

        for(int i = 0; i < data.bornBuffs.Count; i++)
        {
            AddBuff(data.bornBuffs[i], -1);//添加固有BUFF
        }
        SkillHelper.CheckWeaponBuff(this);

        MessageEventArgs args = new MessageEventArgs();
        args.AddMessage("Object", this);
        EventManager.Instance.PostEvent(BattleEvent.OnEnemySpawn, args);
    }
Пример #26
0
 private void SendExecuteMessage()
 {
     MessageEventArgs args = new MessageEventArgs();
     args.AddMessage("Message", executeMessage);
     EventManager.Instance.PostEvent(BattleEvent.OnCommandExecute, args);
 }
 public void SelectBasicCommand(int commandID)
 {
     MessageEventArgs args = new MessageEventArgs();
     args.AddMessage("CommandID", commandID);
     EventManager.Instance.PostEvent(BattleEvent.OnBasicCommandSelected, args);
 }
 void OnClick(string name)
 {
     MessageEventArgs args = new MessageEventArgs ();
     args.AddMessage ("ItemID", itemData.id);
     EventManager.Instance.PostEvent (UIEvent.OnItemClicked, args);
 }
Пример #29
0
 public bool Init( BackBlock block, TimeLine.TokenInfo tokenInfo )
 {
     maxSize = tokenInfo.maxSize;
     move = tokenInfo.move;
     resize = tokenInfo.resize;
     eat = tokenInfo.eat;
     delete = tokenInfo.delete;
     if ( tokenInfo.size == -1 )
         size = UnityEngine.Random.Range(1 , 4);
     else
         size = tokenInfo.size;
     if ( !TryAttachTo( block ) )
         return false;
     AdjustSize( size );
     SetMovie( tokenInfo.name );
     StartCoroutine(CheckEnd(tokenInfo.duration));
     ifInit = false;
     MessageEventArgs msg = new MessageEventArgs();
     msg.AddMessage("name" , movieName );
     BEventManager.Instance.PostEvent( EventDefine.OnTokenInit , msg );
     return true;
 }
Пример #30
0
 private void OnMiss()
 {
     MessageEventArgs args = new MessageEventArgs();
     args.AddMessage("Name", target.GetName());
     EventManager.Instance.PostEvent(BattleEvent.BattleObjectMiss, args);
 }
    protected void OnReady()
    {
        timelinePosition = GlobalDataStructure.BATTLE_TIMELINE_READY;
        isBlocking = false;
        isEvading = false;
        battleStatus = BattleStatus.Ready;
        if(guardedTarget != null)
        {
            guardedTarget.guardTarget = null;
            guardedTarget = null;
        }

        if(data.battleType == BattleType.Physical)
        {//自愈机制
            if(currentHP >= maxHP * GlobalDataStructure.HP_RECOVER_THRESHOLD && currentHP < maxHP)
            {
                int recoverAmount = currentHP;
                currentHP += (int) (maxHP * GlobalDataStructure.HP_RECOVER_AMOUNT);
                recoverAmount = currentHP - recoverAmount;

                MessageEventArgs args = new MessageEventArgs();
                args.AddMessage("Name", GetName());
                args.AddMessage("Amount", recoverAmount);
                EventManager.Instance.PostEvent (BattleEvent.OnHPAutoRecover, args);
            }
        }
        else if(data.battleType == BattleType.Magical)
        {//回复机制
            if( currentHP < maxHP)
            {
                int recoverAmount = currentHP;
                currentHP += (int) (maxHP * GlobalDataStructure.MP_RECOVER_AMOUNT);
                recoverAmount = currentHP - recoverAmount;

                MessageEventArgs args = new MessageEventArgs();
                args.AddMessage("Name", GetName());
                args.AddMessage("Amount", recoverAmount);
                EventManager.Instance.PostEvent (BattleEvent.OnMPAutoRecover, args);
            }
        }

        List<Buff> toRemoveList = new List<Buff>();
        foreach(Buff buff in buffList)
        {
            buff.Tick();
            if(buff.effectTurns == 0)
            {
                toRemoveList.Add(buff);
            }
        }
        foreach(Buff buff in toRemoveList)
        {
            buffList.Remove(buff);
        }

        availableCommands = Command.GetAvailableCommands(this);
    }
Пример #32
0
    private void OnCriticalHit()
    {
        this.dmg *= 2;
        AudioManager.Instance.PlaySE("critical");

        MessageEventArgs args = new MessageEventArgs();
        args.AddMessage("Name", target.GetName());
        EventManager.Instance.PostEvent(BattleEvent.BattleObjectCritical, args);
    }
 /*---------- Callback ----------*/
 void OnClick()
 {
     if(allowClick)
     {
         MessageEventArgs args = new MessageEventArgs();
         args.AddMessage("Target", this.GetComponent<BattleObject>());
         EventManager.Instance.PostEvent(BattleEvent.OnCommandSelected, args);
     }
 }
Пример #34
0
    private void OnCounter()
    {
        MessageEventArgs args = new MessageEventArgs();
        args.AddMessage("Name",target.GetName());
        EventManager.Instance.PostEvent(BattleEvent.BattleObjectCounter, args);

        BattleFormula.OnCounterDamage(target, source);
    }
 void OnClick()
 {
     MessageEventArgs args = new MessageEventArgs ();
     args.AddMessage ("CommandName", nameText.text);
     EventManager.Instance.PostEvent (BattleEvent.OnCommandClicked, args);
 }