Exemple #1
0
 public void DispatchEvent(FLEventBase e)
 {
     if (e.target == null)
     {
         e.target = this;
     }
     if (_handlers != null && _handlers.ContainsKey(e.Type))
     {
         List <FLEventBase.FLEventHandler> eventHandlers = _handlers [e.Type];
         int i = 0;
         FLEventBase.FLEventHandler lastHandler    = null;
         FLEventBase.FLEventHandler currentHandler = null;
         while (i < eventHandlers.Count)
         {
             currentHandler = eventHandlers [i];
             if (currentHandler != lastHandler)
             {
                 currentHandler(e);
             }
             else
             {
                 i++;
             }
             lastHandler = currentHandler;
         }
     }
 }
Exemple #2
0
 static public int constructor(IntPtr l)
 {
     try {
         int         argc = LuaDLL.lua_gettop(l);
         FLEventBase o;
         if (argc == 1)
         {
             o = new FLEventBase();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 2)
         {
             System.String a1;
             checkType(l, 2, out a1);
             o = new FLEventBase(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    public virtual FLEventBase Clone()
    {
        FLEventBase e = (Activator.CreateInstance(this.GetType()) as FLEventBase);

        e.Type = this._type;
        return(e);
    }
Exemple #4
0
    private void OnTimerFinish(FLEventBase e)
    {
        Debug.Log("OnTimerFinish-Interrupt");

        DispatchEvent(new FLEvent(FLEvent.STOP));             // Game Finish , Counting Panel
        Debug.Log("FLEvent.STOP");
        updateDelegate = null;
    }
Exemple #5
0
    private void OnTimerReset(FLEventBase e)
    {
        m_bTimer = 0;

        float m_bTimerInverse = 180f - m_bTimer;

        UIClock.text = (int)(m_bTimerInverse / 60) + ":" + (int)(m_bTimerInverse) % 60;
    }
Exemple #6
0
    private void OnTimerStart(FLEventBase e)
    {
        Debug.Log("OnTimerStart");

        updateDelegate = BehaviorDoUpdateTimer;

        Time.timeScale = 1;
        Debug.Log("TimeScale:" + Time.timeScale);
    }
Exemple #7
0
    private void OnTimerResume(FLEventBase e)
    {
        //	Debug.Log("OnTimerResume");
        //m_bTimer+=1.0f;

        //m_bTimer_5SecCount+=1.0f;

        updateDelegate = BehaviorDoUpdateTimer;
    }
 public void DispatchEvent(FLEventBase e, string t = "")
 {
     if (e.target != null)
     {
         // This event is dispatched from other target
         e = e.Clone();
     }
     e.target = this;
     eventDispatcher.DispatchEvent(e, t);
 }
Exemple #9
0
 static public int get_Type(IntPtr l)
 {
     try {
         FLEventBase self = (FLEventBase)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.Type);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #10
0
 static public int Clear(IntPtr l)
 {
     try {
         FLEventBase self = (FLEventBase)checkSelf(l);
         self.Clear();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #11
0
 static public int set_Type(IntPtr l)
 {
     try {
         FLEventBase self = (FLEventBase)checkSelf(l);
         string      v;
         checkType(l, 2, out v);
         self.Type = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #12
0
 static public int set_target(IntPtr l)
 {
     try {
         FLEventBase        self = (FLEventBase)checkSelf(l);
         IFLEventDispatcher v;
         checkType(l, 2, out v);
         self.target = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #13
0
 public void DispatchEvent(FLEventBase e, string type = "")
 {
     if (!string.IsNullOrEmpty(type))
     {
         e.Type = type;
     }
     if (e.target == null)
     {
         e.target = this;
     }
     if (_handlers != null && _handlers.ContainsKey(e.Type))
     {
         List <FLEventBase.FLEventHandler> eventHandlers = _handlers[e.Type];
         int i = 0;
         while (i < eventHandlers.Count)
         {
             eventHandlers[i] (e);
             ++i;
         }
     }
 }
Exemple #14
0
    private void OnTimerPause(FLEventBase e)
    {
//		Debug.Log("OnTimerPause");
        updateDelegate = null;
    }
 public void passEvent(FLEventBase e, string t = "")
 {
     eventDispatcher.DispatchEvent(e, t);
 }
    void OnGameFinish(FLEventBase e)
    {
        m_Car.isMove = false;


        //UI_BtnGameStart.SetActive(false);
        m_PathGenerator.StopAutoGenerator();

//		xMain.Instance.PauseResumeGame();
//		xMain.Instance.roundlog_InsertResult((int)Point_Health, (int)Point_Science, (int)Point_Culture, (int)Point_Civilization, (int)Point_Mine);
//
        UI_ResultPanel.SetActive(true);
        UI_PauseButton.SetActive(false);

        //Controller_ResultPanel

        bool bWin = false;

        if (UI_LifeBar.value > 0)
        {
            bWin = true;
        }

        if (bWin)
        {
            double LifeScore = Math.Round(UI_LifeBar.value, 1, MidpointRounding.AwayFromZero);

            UI_ResultPanel.GetComponent <Controller_ResultPanel>().ShowResult(bWin, (int)(LifeScore * 100) * 100);


            // TODO:   should check the current level number first ( because you may play the previous mission now )
            //xMain.Instance.mRoundData.score_normal = (int) (UI_LifeBar.value*100 )*100 ;  // <RankingFix>-1
            xMain.Instance.nRoundCurrentScore_Normal = (int)(LifeScore * 100) * 100;             // <RankingFix>-1
            xMain.Instance.mRoundData.score_normal  += xMain.Instance.nRoundCurrentScore_Normal; // <RankingFix>-1


            if (xMain.Instance.m_CurrentGameMode == GAMEMODE.MODE_NORMAL)
            {
                xMain.Instance.mRoundData.level_normal += 1;
                xMain.Instance.RoundData_Update_Local();                 // <RankingFix>-3
            }
        }
        else          // Lose
        {
            // V2
            if (xMain.Instance.m_GameLevel_AotoMode)
            {
                Debug.Log("Lose");
                if (xMain.Instance.mRoundData.level_normal > 0)
                {
                    xMain.Instance.mRoundData.level_normal -= 1;

                    Debug.Log("Lose-level minus 1:" + xMain.Instance.mRoundData.level_normal);

                    xMain.Instance.RoundData_Update_Local();                     // <RankingFix>-3
                }
            }

            UI_ResultPanel.GetComponent <Controller_ResultPanel>().ShowResult(bWin);
        }

        m_TimerRoundEnd = System.DateTime.Now;
        System.TimeSpan TimeDiff = m_TimerRoundEnd - m_TimerRoundStart;

        m_CurrentGameMode.GameFinish(bWin);
        //xMain.Instance.CurrentGameMode_GameFinish(bWin);


        xMain.Instance.WriteLogIntoFile("Time_End-" + bWin + "," + m_TimerRoundEnd.ToString("hh:mm:ss:fff"));
        xMain.Instance.WriteLogIntoFile("TimeTotaSec," + TimeDiff.TotalSeconds);


        //xMain.Instance.WriteLogIntoFile_DumpToFile(   );
        //WriteLogIntoFile_DumpToFile
    }