Ejemplo n.º 1
0
 void changeLockState(bool isLock)
 {
     if (mainActor)
     {
         LogicEvent.fire2Rendering("onEnableRecordInput", isLock);
     }
 }
Ejemplo n.º 2
0
 public FBPlayerAgent(FBActor actor, behaviac.Workspace workspace)
 {
     this.actor = actor;
     behaviour  = createBehaviour(workspace);
     LogicEvent.add("onShootBallOut", this, "onShootBallOut");
     LogicEvent.add("onPlayTaunt", this, "onPlayTaunt");
 }
Ejemplo n.º 3
0
        void playEnemyDefiance(ActorView enemy)
        {
            LogicEvent.fire("onPlayTaunt", enemy.id);
            var self = SceneViews.instance.getCurFBScene().getMainActor();

            around(enemy, self);
        }
Ejemplo n.º 4
0
    public override void execute(Fix64 deltaTime)
    {
        base.execute(deltaTime);
        switch (subState)
        {
        case SubState.Wait:
            if (timer < game.fbWorld.config.replayTimeAfterGoal)
            {
                return;
            }
            game.fbWorld.setEnableBT(true);
            LogicEvent.fire2Rendering("onBeginGoalShow");
            resetTimer();
            subState = SubState.Show;
            return;

        case SubState.Show:
            if (timer < game.fbWorld.config.goalShowTime)
            {
                return;
            }
            game.onShowReplayLogo();
            resetTimer();
            subState = SubState.ShowLogo;
            return;

        case SubState.ShowLogo:
            if (timer < (Fix64)0.3f)
            {
                return;
            }
            game.changeState(GameState.Replay);
            return;
        }
    }
Ejemplo n.º 5
0
    public override void enter()
    {
        game.changeCampState(game.goalTeam);
        FBActor mainActor = game.fbWorld.getMainActor();
        var     team      = mainActor == null ? FBTeam.kBlue : mainActor.team;
        var     camp      = game.getCampType(team);

        game.onGameReady(camp);
        game.playersAITakeOver(false);
        game.resetPlayerState();

        game.resetPosition();

        game.changeCampState(game.goalTeam);
        game.fbWorld.setEnableBT(false);
        game.onEnableRecordInput(false);
        subState = SubState.Wait;
        if (game.preStateType == GameState.Replay)
        {
            waitTime      = game.fbWorld.config.replayWaitTime;
            countdownTime = Fix64.Zero;
        }
        else
        {
            waitTime      = Fix64.One;
            countdownTime = game.fbWorld.config.readyTime;
            if (WithoutEnterShow_4Test_EditorOnly.instance != null)
            {
                countdownTime = Fix64.Zero;
            }
            LogicEvent.fire2Lua("onFirstRound");
        }
    }
Ejemplo n.º 6
0
        public static void doDone(BallLastDetachAction actionObject)
        {
            var scene = SceneViews.instance.getCurFBScene();

            scene.ballDetach(actionObject.objectID);
            LogicEvent.fire2Rendering("onBallLastDetached", actionObject.objectID);
        }
Ejemplo n.º 7
0
        private void GetTickerResult(string response)
        {
            LogicEvent handler = LogicEventListener;

            if (string.IsNullOrEmpty(response))
            {
                Helper.Log("Get ticker from api server failed...");
                handler(LOGIC_EVENT.TICKERS_LOAD_FAILED, this);
            }
            else
            {
                var tickers            = JsonConvert.DeserializeObject <List <dynamic> >(response);
                var structured_tickers = new List <Ticker>();
                foreach (dynamic ticker in tickers)
                {
                    if (ticker.Count == 11)
                    {
                        var structured_ticker = new Ticker()
                        {
                            Pair      = ticker[0],
                            LastPrice = ticker[7],
                        };
                        structured_tickers.Add(structured_ticker);
                    }
                }
                Helper.Log(string.Format("Get ticker from api server {0}", response));
                handler(LOGIC_EVENT.TICKERS_LOADED, structured_tickers);
            }
        }
Ejemplo n.º 8
0
    // Use this for initialization
    private void Start()
    {
        m_skillColorId = Shader.PropertyToID("SkillColor");

        LogicEvent.add("lerpSkillColor", this, "lerpSkillColor");
        LogicEvent.add("resetSkillColor", this, "resetSkillColor");
    }
Ejemplo n.º 9
0
 public void LogicStart()
 {
     LogicEvent.fire("onFBGameStart");
     fbWorld.world.resetFrame();
     aiWorld.reset();
     changeState(GameState.Ready);
 }
Ejemplo n.º 10
0
    public void onShootBallOut(FBActor actor, FixVector3 velocity, Fix64 angle, FixVector3 target)
    {
        //jlx2017.05.26-log:因为行为树也要使用这个消息,所以使用fire,而不使用fire2Rendering
        LogicEvent.fire("onShootBallOut", actor.id);

        fbGame.generateRenderAction <RAL.BallShootAction>(actor.id, actor.shootingType, velocity.toVector3(), (float)angle, target.toVector3());
    }
Ejemplo n.º 11
0
 public virtual void HandleEvent(EventDef ev, LogicEvent le)
 {
     if (mhandler != null)
     {
         mhandler(ev, le);
     }
 }
Ejemplo n.º 12
0
    public void setupFBGame(ulong tableId, uint mapID)
    {
        LogicEvent.add("onChangeCampState", this, "onChangeCampState");

        frameSync = new FrameSync();
        frameSync.addLogicUpdator(this);
        frameSync.frameSyncEventHandler = this;

        this.tableId = tableId;

        fbWorld            = new FBWorld(this);
        fbWorld.randomSeed = 100;

        var worldConfig = new FBWorld.Configuration();
        var btConfig    = new FBWorld.BTConfiguration(worldConfig.worldSize);

        fbWorld.setup(worldConfig, btConfig);
        matchTimer = Fix64.Zero;
        ////创建球
        createBall();

        fbWorld.onGoal += goal;

        onFBGameCreated();
    }
Ejemplo n.º 13
0
    public void onBeginReplay(uint beginFrame,
                              uint endFrame,
                              ushort goalTime,
                              ushort replayTime,
                              ulong goaler,
                              Location door,
                              ushort blueScore,
                              ushort redScore,
                              uint gkId,
                              float positionRandomValue,
                              float shootRandomValue,
                              float goalRandomValue,
                              bool selfGoal)
    {
        generateRenderAction <RAL.ReplayBeginAction>(beginFrame,
                                                     endFrame,
                                                     goalTime,
                                                     replayTime,
                                                     goaler,
                                                     door,
                                                     blueScore,
                                                     redScore,
                                                     gkId,
                                                     positionRandomValue,
                                                     shootRandomValue,
                                                     goalRandomValue,
                                                     goalTeam);

        LogicEvent.fire2Rendering("onBeginReplay", door, gkId, positionRandomValue, shootRandomValue, goalRandomValue);
    }
Ejemplo n.º 14
0
    public FBGame newFBGame()
    {
        fbGame = new FBGame();

        LogicEvent.fire("onFBGameNewed");

        return(fbGame);
    }
Ejemplo n.º 15
0
 private void OnEnable()
 {
     LogicEvent.RegEvent(LogicEvent.CALENDAR_SELECTED, OnSelected);
     if (initFlag)
     {
         calendarPanel.InitAllCalendars();
     }
 }
Ejemplo n.º 16
0
 public void onLoginSucceed()
 {
     if (!hasLogin)
     {
         hasLogin = true;
         LogicEvent.fire2Lua("onUserLoginOk");
     }
 }
Ejemplo n.º 17
0
        public static void doDone(GoalAction actionObject)
        {
            LogicEvent.fire2Rendering("onBallGoal", actionObject.team, actionObject.door, actionObject.objectID);
            LogicEvent.fire2Lua("onGoal", actionObject.door == Location.kLeftDoor);
            var scene = SceneViews.instance.getCurFBScene();

            scene.recordingAnimatorState = false;
            scene.setActorsAnimatorController(true);
        }
    public override void HandleEvent(EventDef ev, LogicEvent le)
    {
        base.HandleEvent(ev, le);

        if (ev == EventDef.Test)
        {
            Logger.Log("..............Test");
        }
    }
Ejemplo n.º 19
0
    public override void onInit()
    {
        base.onInit();

        LogicEvent.add("onFBGameCreated", this, "onFBGameCreated");
        LogicEvent.add("onFBGameDestroyed", this, "onFBGameDestroyed");
        LogicEvent.add("onFBReplayCreated", this, "onFBReplayCreated");
        LogicEvent.add("onFBReplayDestroyed", this, "onFBReplayDestroyed");
    }
Ejemplo n.º 20
0
        public static void doDone(GameReadyAction actionObject)
        {
            var scene = SceneViews.instance.getCurFBScene();

            scene.setActorsAnimatorController(false);
            scene.ball.hideEnergyEffect();
            scene.recordingAnimatorState = true;
            LogicEvent.fire2Lua("onGameReady");
        }
Ejemplo n.º 21
0
 public override void enter()
 {
     base.enter();
     actor         = SceneViews.instance.getCurFBScene().getActor(cameraCtrl.goaler);
     timer         = 0;
     waitTime      = cameraCtrl.config.goalBeginTime;//转身时间
     beginGoalShow = false;
     LogicEvent.add("onBeginGoalShow", this, "onBeginGoalShow");
 }
Ejemplo n.º 22
0
 public void OnPointerClick(PointerEventData pointerEventData)
 {
     if (isEmpty || isLocked)
     {
         return;
     }
     Debug.Log("点击了" + dateTime.ToShortDateString());
     LogicEvent.Broadcast(LogicEvent.CALENDAR_SELECTED, dateTime, this.gameObject);
 }
Ejemplo n.º 23
0
    public void Fire(string name, string data)
    {
        LogicEvent findevent = null;

        if (_events.TryGetValue(name, out findevent))
        {
            _events[name].Invoke(data);
        }
    }
    private void PushEvent(LogicEvent le)
    {
        mListEvent.Add(le);

        if (mListEvent.Count > 50)
        {
            int i = 0;
            ++i;
        }
    }
Ejemplo n.º 25
0
    public override void onEnter()
    {
        base.onEnter();
        LogicEvent.add("onEnableRecordInput", this, "onEnableRecordInput");

#if UNITY_EDITOR
        LogicEvent.add("onDoorKeeperCatchingBallView", this, "onDoorKeeperCatchingBallView");
        LogicEvent.add("onMainCharacterPassingBall", this, "onMainCharacterPassingBall");
#endif
    }
Ejemplo n.º 26
0
    static public LogicEvent CreateEvent()
    {
        LogicEvent le = msEventPool.Alloc();

        if (le != null)
        {
            return(le);
        }

        return(new LogicEvent());
    }
Ejemplo n.º 27
0
    public void AddListener(string name, UnityAction <string> func)
    {
        LogicEvent findevent = null;

        if (!_events.TryGetValue(name, out findevent))
        {
            findevent     = new LogicEvent();
            _events[name] = findevent;
        }
        findevent.AddListener(func);
    }
Ejemplo n.º 28
0
        public static void doDone(BallCollidedWallAction actionObject)
        {
#if ARTIEST_MODE
            LogicEvent.fire("editor_onBallHit", actionObject.point);
#else
            var ball = SceneViews.instance.getCurFBScene().ball;
            //jlx2017.07.05-log:这里加负号是为了将墙的法线反向
            ball.hitWall(actionObject.point, -actionObject.normal, actionObject.kickerElement);
            ball.setRotateType(actionObject.velocity);
#endif
        }
Ejemplo n.º 29
0
 public void onGameReady(CampType camp)
 {
     LogicEvent.fire2Rendering("onGameReady", camp);
     if (m_currentRenderActionList != null)
     {
         generateRenderAction <RAL.GameReadyAction>();
     }
     else
     {
         generateRenderActionToTargetList <RAL.GameReadyAction>(RenderActionListType.kLogicBefore);
     }
 }
Ejemplo n.º 30
0
 public override void enter()
 {
     base.enter();
     LogicEvent.add("onShowEnemy", this, "onShowEnemy");
     //jlx 2017.06.22-log:查找Tag为CameraRoot的物体
     ModelResourceLoader.inst.loadModel("EnterCameraAnimation", go =>
     {
         go.transform.localEulerAngles = Vector3.zero;
         cameraAnimation          = go.GetComponent <Animation>();
         animationCameraTransform = go.transform.Find("Camera");
     });
 }