Ejemplo n.º 1
0
 void Start()
 {
     //Const.CONST_ENERGY_RECOVER_TIME = 1;
     InvokeRepeating("AddEnergy", Const.CONST_ENERGY_RECOVER_TIME, Const.CONST_ENERGY_RECOVER_TIME);
     InvokeRepeating("UseEnergy", 1, 1);
     CEventDispatcher.GetInstance().AddEventListener(CEventType.ENERGY_ENOUGH, EnergyEnoughEffect);
 }
Ejemplo n.º 2
0
 void OnDestroy()
 {
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.GAME_WIN, EndSkill);
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.MOVE_TO_NEXT, EndSkill);
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.ENERGY_EMPTY, EndSkill);
     EndSkill();
 }
Ejemplo n.º 3
0
 public void EndMoveToNext()
 {
     ScrollSceneManager.instance.DisableScroll();
     enemyGroup.InstUnits();
     mineGroup.MoveForward();
     CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.NEXT_BATTALE_START, this));
 }
Ejemplo n.º 4
0
 public static CEventDispatcher GetInstance()
 {
     if (instance == null)
     {
         instance = new CEventDispatcher();
     }
     return(instance);
 }
Ejemplo n.º 5
0
 public void Win()
 {
     mineGroup.Win();
     DungeonStoryPlayer.PlayAfterBossDialog(delegate()
     {
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_WIN, this));
     });
 }
Ejemplo n.º 6
0
 void Start()
 {
     bomb   = GetComponentInChildren <Bomb>();
     mTrans = transform;
     mTrans.localPosition = from;
     CEventDispatcher.GetInstance().AddEventListener(CEventType.MOVE_TO_NEXT, OnMoveToNext);
     ui = GetComponent <UIWidget>();
     DragClick.instance.AddListenUI(ui);
 }
Ejemplo n.º 7
0
    public override void Init()
    {
        self = GetComponent <HeroFightUnit>();
        /* 自动使用技能,当处于自动战斗或者混乱状态下 */
        self.OnNoramlAttackFinish += ThinkUseSkill;
        /*普通攻击初始化*/
        normalAttack        = NGUITools.AddChild <NormalAttack>(gameObject);
        normalAttack.attack = Util.GetDic <MsgAttackData, AttackData>()[normalAttackId];
        JsonData castEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.castEffect));

        for (int i = 0; i < castEffectDt.Count; i++)
        {
            normalAttack.castEffectIds.Add((int)castEffectDt[i]);
        }
        JsonData flyEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.flyEffect));

        for (int i = 0; i < flyEffectDt.Count; i++)
        {
            normalAttack.flyEffectIds.Add((int)flyEffectDt[i]);
        }
        JsonData hitEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.hitEffect));

        for (int i = 0; i < hitEffectDt.Count; i++)
        {
            normalAttack.hitEffectIds.Add((int)hitEffectDt[i]);
        }
        normalAttack.mineUnit = self;
        normalAttack.Init();
        /*主动技能初始化*/
        normalSkill             = NGUITools.AddChild <ActiveSkill>(gameObject);
        normalSkill.normalSkill = Util.GetDic <MsgNormalSkill, NormalSkill>()[normalSkillId];
        int LvUpId = normalSkillId * 100 + normalSkillLv;

        normalSkill.normalSkillLvUp = Util.GetDic <MsgNormalSkillLvUp, NormalSkillLvUp>()[LvUpId];
        normalSkill.dmgEffectId     = (int)normalSkill.normalSkill.dmgEffect;
        normalSkill.castEffectId    = (int)normalSkill.normalSkill.castEffect;
        normalSkill.flyEffectId     = (int)normalSkill.normalSkill.flyEffect;
        normalSkill.hitEffectId     = (int)normalSkill.normalSkill.hitEffect;
        normalSkill.mineUnit        = self;
        normalSkill.Init();
        /*绝技初始化*/
        specailSkill = NGUITools.AddChild <UniqueSkill>(gameObject);
        specailSkill.specialSkill = Util.GetDic <MsgSpecialSkill, SpecialSkill>()[specailSkillId];
        int specailLvId = specailSkillId * 100 + specailSkillLv;

        specailSkill.specialSkillLvUp = Util.GetDic <MsgSpecialSkillLvUp, SpecialSkillLvUp>()[specailLvId];
        specailSkill.castEffectId     = (int)specailSkill.specialSkill.castEffect;
        specailSkill.dmgEffectId      = (int)specailSkill.specialSkill.dmgEffect;
        specailSkill.flyEffectId      = (int)specailSkill.specialSkill.flyEffect;
        specailSkill.hitEffectId      = (int)specailSkill.specialSkill.hitEffect;
        specailSkill.mineUnit         = self;
        specailSkill.Init();
        /*队长技能初始化*/

        CEventDispatcher.GetInstance().AddEventListener(CEventType.MOVE_TO_NEXT, ResetAutoState);
    }
Ejemplo n.º 8
0
 void OnS2C_ResponseFightBegin(BaseEvent evt)
 {
     DungeonManager.enemyWave.Clear();
     clientmsg.s2c_fightbegin fightbegin = (clientmsg.s2c_fightbegin)evt.Params["protomsg"];
     ArrangementPanel.data = fightbegin.enemylist;
     if (ArrangementPanel.data.Count > 0)
     {
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_DATA, null));
     }
 }
Ejemplo n.º 9
0
    void Awake()
    {
        CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_WIN, Evaluate);
        CEventDispatcher.GetInstance().AddEventListener(CEventType.MOVE_TO_NEXT, UpdateWaveUI);
        CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_OVER, OnGameOver);

        instance = this;
        enabled  = false;
        DungeonRecord.Clear();
        StartCoroutine(Init());
    }
Ejemplo n.º 10
0
 void OnDestroy()
 {
     if (DragClick.hasInstance)
     {
         DragClick.instance.RemoveListenUI(ui);
     }
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.MOVE_TO_NEXT, OnMoveToNext);
     if (!hasFreeBomb)
     {
         DungeonRecord.unKillWuya++;
     }
 }
Ejemplo n.º 11
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.S))
     {
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.NEXT_BATTALE_START, this));
     }
     if (Input.GetKeyDown(KeyCode.O))
     {
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_OVER, this));
     }
     if (Input.GetKeyDown(KeyCode.W))
     {
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_WIN, this));
     }
 }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        if (material != null)
        {
            if (DoMatChange(PropertyName))
            {
                Debug.Log("Has");
            }
        }
        Hashtable hashtable = new Hashtable();

        hashtable.Add("神1", "Go1");
        hashtable.Add("神2", "Go2");


        CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_DATA, hashtable, this.gameObject));
    }
Ejemplo n.º 13
0
 public void EndMoveToNext()
 {
     ScrollSceneManager.instance.DisableScroll();
     enemyGroup.InstUnits();
     if (enemyGroup.wave == DungeonManager.enemyWave.Count)
     {
         DungeonStoryPlayer.PlayPreBossDialog(delegate()
         {
             enemyGroup.MoveForward();
             mineGroup.MoveForward();
             CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.NEXT_BATTALE_START, this));
         });
     }
     else
     {
         enemyGroup.MoveForward();
         mineGroup.MoveForward();
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.NEXT_BATTALE_START, this));
     }
 }
Ejemplo n.º 14
0
 void OnDestroy()
 {
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.NEXT_BATTALE_START, StartKongxi);
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.GAME_WIN, StopKongxi);
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.GAME_OVER, StopKongxi);
 }
Ejemplo n.º 15
0
 void Start()
 {
     CEventDispatcher.GetInstance().AddEventListener(CEventType.NEXT_BATTALE_START, StartKongxi);
     CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_WIN, StopKongxi);
     CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_OVER, StopKongxi);
 }
Ejemplo n.º 16
0
    public override void Init()
    {
        CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_WIN, EndSkill);
        CEventDispatcher.GetInstance().AddEventListener(CEventType.MOVE_TO_NEXT, EndSkill);
        CEventDispatcher.GetInstance().AddEventListener(CEventType.ENERGY_EMPTY, EndSkill);

        //魔法动作
        string   magicDt = Util.GetConfigString(specialSkill.delay);
        JsonData jd00    = JsonMapper.ToObject(magicDt);

        if (jd00.Count > 0)
        {
            magicDelay = new float[jd00.Count];
            for (int i = 0; i < jd00.Count; i++)
            {
                magicDelay[i] = float.Parse(jd00[i].ToString());
            }
        }

        //施法动作
        string   action01 = Util.GetConfigString(specialSkill.preAction);
        JsonData jd01     = JsonMapper.ToObject(action01);

        if (jd01.Count > 0)
        {
            preActionName     = jd01[0].ToString();
            preActionWorkTime = new float[jd01[1].Count];
            for (int i = 0; i < jd01[1].Count; i++)
            {
                preActionWorkTime[i] = float.Parse(jd01[1][i].ToString());
            }
        }

        //持续施法动作
        string   action02 = Util.GetConfigString(specialSkill.skillAction);
        JsonData jd02     = JsonMapper.ToObject(action02);

        if (jd02.Count > 0)
        {
            actionName     = jd02[0].ToString();
            actionWorkTime = new float[jd02[1].Count];
            for (int i = 0; i < jd02[1].Count; i++)
            {
                actionWorkTime[i] = float.Parse(jd02[1][i].ToString());
            }
        }

        //buff
        string   buffString = Util.GetConfigString(specialSkillLvUp.buff);
        JsonData dt_1       = JsonMapper.ToObject(buffString);

        for (int i = 0; i < dt_1.Count; i++)
        {
            JsonData   dt_2 = dt_1[i];
            buffConfig bc   = new buffConfig();
            bc.id        = int.Parse(dt_2[0].ToString());
            bc.percent   = float.Parse(dt_2[1].ToString());
            bc.value     = float.Parse(dt_2[2].ToString());
            bc.time      = float.Parse(dt_2[3].ToString());
            bc.level     = int.Parse(dt_2[4].ToString());
            bc.bindSkill = this;
            buffConfigList.Add(bc);
        }

        //附加效果
        attachExtension      = (SkillAttach)specialSkillLvUp.addEffect;
        attachExtensionParam = JsonMapper.ToObject(Util.GetConfigString(specialSkillLvUp.addEffectVal));

        base.Init();
    }
Ejemplo n.º 17
0
 void OnDestroy()
 {
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.GAME_WIN, Evaluate);
 }
Ejemplo n.º 18
0
 // Start is called before the first frame update
 void Start()
 {
     CEventDispatcher.GetInstance().AddEventListener("开始触发", MyTestFunc);
     CEventDispatcher.GetInstance().DispatchStringEvent(new CBaseEvent("开始触发", "这是重要数值123"));
 }
Ejemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     Util.CloseDialog(DialogType.Duplicate);
     // AWConnection.awnetgate.AddEventListener(AWEvent.S2C_INTOEMBATTLE, OnIntoemBattle);
     CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_DATA, LoadEnemyGroup);
 }
Ejemplo n.º 20
0
 void Start()
 {
     CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_WIN, Evaluate);
 }
Ejemplo n.º 21
0
 private void Awake()
 {
     CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_DATA, MyTestFun);
     CEventDispatcher.GetInstance().AddEventListener(CEventType.GAME_OVER, MyTestFun);
 }
Ejemplo n.º 22
0
 void OnDestroy()
 {
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.GAME_WIN, Evaluate);
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.MOVE_TO_NEXT, UpdateWaveUI);
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.GAME_OVER, OnGameOver);
 }
Ejemplo n.º 23
0
 public void MoveToNext()
 {
     StartCoroutine(StartMoveToNext());
     CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.MOVE_TO_NEXT, this));
 }
Ejemplo n.º 24
0
 public void Win()
 {
     mineGroup.Win();
     CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_WIN, this));
 }
Ejemplo n.º 25
0
 public void GameOver()
 {
     CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_OVER, this));
 }
Ejemplo n.º 26
0
 void OnDestroy()
 {
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.ENERGY_ENOUGH, EnergyEnoughEffect);
 }
Ejemplo n.º 27
0
 void OnDestroy()
 {
     CEventDispatcher.GetInstance().RemoveEventListener(CEventType.MOVE_TO_NEXT, ResetAutoState);
 }