示例#1
0
    public Int32 ProcessEvents()
    {
        if ((Int32)FF9StateSystem.Common.FF9.fldMapNo == 303 || (Int32)FF9StateSystem.Common.FF9.fldMapNo == 304)
        {
            if (FF9StateSystem.Settings.IsNoEncounter)
            {
                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(53189, 0);

                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(52933, 0);

                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(52677, 0);
            }
        }
        else if ((Int32)FF9StateSystem.Common.FF9.fldMapNo == 301)
        {
            if (FF9StateSystem.Settings.IsNoEncounter)
            {
                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(61381, 0);

                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(61125, 0);
            }
        }
        else if ((Int32)FF9StateSystem.Common.FF9.fldMapNo == 302)
        {
            if (FF9StateSystem.Settings.IsNoEncounter)
            {
                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(53189, 0);

                PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(52933, 0);
            }
        }
        else if ((Int32)FF9StateSystem.Common.FF9.fldMapNo == 2921 && FF9StateSystem.Settings.IsNoEncounter)
        {
            PersistenSingleton <EventEngine> .Instance.eBin.setVarManually(10461, 10);
        }
        Boolean flag     = false;
        Boolean isBattle = this.gMode == 2;

        this._moveKey = false;
        for (ObjList objList = this._context.activeObj; objList != null; objList = objList.next)
        {
            Obj obj = objList.obj;
            if ((Int32)obj.cid == 4)
            {
                Actor actor = (Actor)obj;
                FieldMapActorController mapActorController = actor.fieldMapActorController;
                if ((Int32)obj.uid == (Int32)this._context.controlUID && (Int32)obj.state == (Int32)EventEngine.stateRunning)
                {
                    if ((Int32)this._context.usercontrol != 0)
                    {
                        if (this.gMode == 1)
                        {
                            //if (!((UnityEngine.Object)mapActorController != (UnityEngine.Object)null))
                            //    ;
                            this._moveKey = FieldMapActorController.ccSMoveKey;
                        }
                        else if (this.gMode == 3)
                        {
                            Single distance = 0.0f;
                            this._moveKey = ff9.w_frameEncountEnable;
                            this.CollisionRequest((PosObj)obj);
                            PosObj posObj = (PosObj)this.Collision(this, actor, 0, ref distance);
                            if (posObj != null && distance <= 0f)
                            {
                                WMActor wmActor  = actor.wmActor;
                                WMActor wmActor2 = ((Actor)posObj).wmActor;
                                Vector2 from     = new Vector2(wmActor.pos0 - wmActor.lastx, wmActor.pos2 - wmActor.lastz);
                                Vector2 to       = new Vector2(wmActor2.pos0 - wmActor.pos0, wmActor2.pos2 - wmActor.pos2);
                                float   num2     = Vector2.Angle(from, to);
                                if (num2 >= 0f && num2 <= 90f)
                                {
                                    wmActor.transform.position = new Vector3(wmActor.lastx, wmActor.lasty, wmActor.lastz);
                                }
                            }
                        }
                        if (this._moveKey)
                        {
                            this.ResetIdleTimer(0);
                        }
                    }
                    else if ((UnityEngine.Object)mapActorController != (UnityEngine.Object)null)
                    {
                        mapActorController.CopyLastPos();
                    }
                }
                else if ((UnityEngine.Object)mapActorController != (UnityEngine.Object)null)
                {
                    mapActorController.CopyLastPos();
                }
                if ((Int32)obj.state == (Int32)EventEngine.stateRunning)
                {
                    if (!isBattle)
                    {
                        this.ProcessAnime((Actor)obj);
                    }
                    //if ((Int32)this._context.usercontrol == 0)
                    //    ;
                }
            }
        }
        if (isBattle)
        {
            this.SetupBattleState();
        }
        this._posUsed = false;
        Int32 num1 = this.eBin.ProcessCode(this._context.activeObj);

        EventHUD.CheckUIMiniGameForMobile();
        if (num1 == 6)
        {
            num1 = 0;
        }
        else
        {
            this.gStopObj = (ObjList)null;
        }
        this._aimObj = (PosObj)null;
        this._eyeObj = (PosObj)null;
        for (ObjList objList = this._context.activeObj; objList != null; objList = objList.next)
        {
            this.SetRenderer(objList.obj, isBattle);
        }
        //if (this.gMode != 1)
        //    ;
        if (isBattle)
        {
            for (ObjList objList = this._context.activeObj; objList != null; objList = objList.next)
            {
                Obj p = objList.obj;
                if ((Int32)p.btlchk == 2 && this.Request(p, 3, 5, false))
                {
                    p.btlchk = (Byte)1;
                }
            }
        }
        else
        {
            for (ObjList objList = this._context.activeObj; objList != null; objList = objList.next)
            {
                Obj    obj    = objList.obj;
                Single deltaX = 0.0f;
                Single deltaY = 0.0f;
                Single deltaZ = 0.0f;
                if ((Int32)obj.cid == 4)
                {
                    Actor actor = (Actor)obj;
                    if (this.gMode == 1)
                    {
                        if ((UnityEngine.Object)obj.go != (UnityEngine.Object)null)
                        {
                            FieldMapActorController component = obj.go.GetComponent <FieldMapActorController>();
                            if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                            {
                                Int32 num2 = 0;
                                if ((Int32)actor.cid != 4 || (Int32)actor.model == (Int32)UInt16.MaxValue)
                                {
                                    num2 = 0;
                                }
                                //else if (component.walkMesh == null)
                                //    ;
                                if (((Int32)obj.uid != (Int32)this._context.controlUID || this.sLockTimer >= 0L) && (num2 & 1) != 0)
                                {
                                    Single distance = 0.0f;
                                    PosObj posObj   = this.fieldmap.walkMesh.Collision(actor.fieldMapActorController, 0, out distance);
                                    if (posObj != null)
                                    {
                                        actor.fieldMapActorController.ResetPos();
                                        if (((Int32)posObj.flags & 16) != 0)
                                        {
                                            this.sLockTimer = 0L;
                                        }
                                        if ((Int32)obj.uid == (Int32)this._context.controlUID)
                                        {
                                            this._collTimer = 2;
                                        }
                                    }
                                }
                            }
                        }
                        if ((Int32)obj.uid == (Int32)this._context.controlUID)
                        {
                            EIcon.ProcessHereIcon((PosObj)actor);
                            if (this.GetUserControl())
                            {
                                this.CollisionRequest((PosObj)actor);
                            }
                        }
                    }
                    else if (this.gMode == 3)
                    {
                        if (((Int32)actor.actf & EventEngine.actEye) != 0)
                        {
                            Vector3 eyePtr = ff9.w_cameraGetEyePtr();
                            eyePtr.x = actor.pos[0];
                            eyePtr.y = actor.pos[1];
                            eyePtr.z = actor.pos[2];
                            ff9.w_cameraSetEyePtr(eyePtr);
                            this._eyeObj = (PosObj)actor;
                        }
                        else if (((Int32)actor.actf & EventEngine.actAim) != 0)
                        {
                            Vector3 aimPtr = ff9.w_cameraGetAimPtr();
                            aimPtr.x = actor.pos[0];
                            aimPtr.y = actor.pos[1];
                            aimPtr.z = actor.pos[2];
                            ff9.w_cameraSetAimPtr(aimPtr);
                            this._aimObj = (PosObj)actor;
                        }
                    }
                    if ((UnityEngine.Object)obj.go != (UnityEngine.Object)null)
                    {
                        if (this.gMode == 3)
                        {
                            WMActor wmActor = ((Actor)obj).wmActor;
                            if ((UnityEngine.Object)wmActor != (UnityEngine.Object)null)
                            {
                                deltaX = (Single)(256.0 * ((Double)wmActor.pos0 - (Double)wmActor.lastx));
                                deltaY = (Single)(256.0 * ((Double)wmActor.pos1 - (Double)wmActor.lasty));
                                deltaZ = (Single)(256.0 * ((Double)wmActor.pos2 - (Double)wmActor.lastz));
                                flag   = !EventEngineUtils.nearlyEqual(wmActor.pos0, wmActor.lastx) || !EventEngineUtils.nearlyEqual(wmActor.pos2, wmActor.lastz);
                                //if ((Int32)obj.sid != 5 && (Int32)obj.sid == 11)
                                //    ;
                            }
                        }
                        else if (this.gMode == 1)
                        {
                            FieldMapActorController component = obj.go.GetComponent <FieldMapActorController>();
                            deltaX = component.curPos.x - component.lastPos.x;
                            deltaY = component.curPos.y - component.lastPos.y;
                            deltaZ = component.curPos.z - component.lastPos.z;
                            flag   = !EventEngineUtils.nearlyEqual(component.curPos.x, component.lastPos.x) || !EventEngineUtils.nearlyEqual(component.curPos.z, component.lastPos.z);
                        }
                        if ((Int32)actor.follow != (Int32)Byte.MaxValue && (UnityEngine.Object)Singleton <DialogManager> .Instance.GetDialogByWindowID((Int32)actor.follow) == (UnityEngine.Object)null)
                        {
                            actor.follow = Byte.MaxValue;
                            if (EventEngine.sLastTalker == actor)
                            {
                                EventEngine.sTalkTimer = 30;
                            }
                        }
                        if (this.gMode == 1)
                        {
                            this.ProcessTurn(actor);
                            if ((Int32)actor.model != (Int32)UInt16.MaxValue)
                            {
                                this.ProcessNeck(actor);
                            }
                        }
                        if (this.gMode == 3)
                        {
                            this.ProcessTurn(actor);
                        }
                        if (flag)
                        {
                            Int32 num2 = (Int32)actor.animFlag & (EventEngine.afExec | EventEngine.afLower | EventEngine.afFreeze);
                            if (num2 == 0 || num2 == (EventEngine.afExec | EventEngine.afLower))
                            {
                                actor.animFlag &= (Byte) ~(EventEngine.afExec | EventEngine.afLower);
                                this.SetAnim(actor, (Int32)actor.speed < (Int32)actor.speedth ? (Int32)actor.walk : (Int32)actor.run);
                            }
                        }
                        else if (((Int32)actor.animFlag & (EventEngine.afExec | EventEngine.afFreeze)) == 0 && (this._collTimer == 0 || (Int32)obj.uid != (Int32)this._context.controlUID))
                        {
                            this.SetAnim(actor, (Int32)actor.idle);
                        }
                        if (flag && (Int32)obj.uid == (Int32)this._context.controlUID && this._moveKey)
                        {
                            Single distance = this.distance(deltaX, deltaY, deltaZ);
                            if (this.gMode == 3)
                            {
                                WMActor wmActor = ((Actor)obj).wmActor;
                            }
                            this._encountTimer += distance;
                            if (!FF9StateSystem.Settings.IsNoEncounter && this.ProcessEncount(actor))
                            {
                                this._encountReserved = true;
                            }
                        }
                    }
                }
            }
        }
        if (this._collTimer > 0)
        {
            --this._collTimer;
        }
        if (EventEngine.sTalkTimer > 0 && --EventEngine.sTalkTimer != 0)
        {
            this.ClearLookTalker();
        }
        if (this._encountReserved && !this._posUsed)
        {
            this._encountReserved = false;
            num1 = 3;
        }
        if ((num1 == 3 || num1 == 7) && this.gMode == 1)
        {
            this.BackupPosObjData();
        }
        if (num1 == 7)
        {
            this.sEventContext1.copy(this.sEventContext0);
        }
        EMinigame.AllTreasureAchievement();
        EMinigame.AllSandyBeachAchievement();
        EMinigame.DigUpKupoAchievement();
        //this.printActorsInObjList(this.E.activeObj);
        return(num1);
    }