Beispiel #1
0
    protected override void OnEnterState(int oldMask, BattleStates state)
    {
        if (state == BattleStates.Ended)
        {
            PlayerPrefs.SetInt("FinishTrain", 1);

            m_loadTime = Time.realtimeSinceStartup - m_loadTime;

            DispatchEvent(Events.LAUNCH_PROCESS, Event_.Pop(LaunchProcess.ShowLevelEnd, 1));
            DispatchEvent(Events.LAUNCH_PROCESS, Event_.Pop(LaunchProcess.ShowLevelTime, m_loadTime));

            moduleStory.workOffline = false;

            DelayEvents.Add(() =>
            {
                moduleGlobal.FadeIn(1.0f, 1, false, () =>
                {
                    Root.instance.StartCoroutine(WaitLoginLoaded());
                });
            }, 1.5f);

            return;
        }
        base.OnEnterState(oldMask, state);
    }
Beispiel #2
0
    private void OnCameraShotUIState(Event_ e)
    {
        if (!Camera_Combat.enableShotSystem)
        {
            return;
        }

        var hide = (bool)e.param1 | moduleBattle.inDialog | Level_PVE.PVEOver;
        var ns   = m_shotShowHide;

        m_shotShowHide = hide ? 1 : 2;

        m_btnPause?.SetInteractable(!hide);

        if (hide && (m_behaviour.hiding || ns == 1) || !hide && (m_behaviour.showing || ns == 2))
        {
            return;
        }

        var alphaOne = Math.Abs(m_behaviour.canvasGroup.alpha - 1) < float.Epsilon;

        if (hide)
        {
            if (actived && Math.Abs(m_behaviour.canvasGroup.alpha) > float.Epsilon)
            {
                m_behaviour.Hide(false);
            }
        }
        else if (!actived || !alphaOne)
        {
            m_behaviour.Show(false);
        }
    }
Beispiel #3
0
    private void OnCreatureAttack(Event_ e)
    {
        m_comboCount = m_player.comboCount;

        if (m_comboCount > moduleBattle.maxCombo)
        {
            moduleBattle.maxCombo = m_comboCount;
            if (Level.current.isPvE)
            {
                modulePVE.SetPveGameData(EnumPVEDataType.Combo, m_comboCount);
            }
        }
        m_comboObj.SetActive(true);
        m_comboNum.PlayComboTween(m_comboCount);

        if (Level.current.isPvE)
        {
            var victim = e.param1 as Creature;
            if (m_avatarRight.creature != victim)
            {
                var m = m_avatarRight.creature as MonsterCreature;
                if (!m || m.isDead || !m.isBoss || !m.visible)
                {
                    m_avatarRight.creature = victim;

                    if (victim is MonsterCreature && (victim as MonsterCreature).isBoss)
                    {
                        InitRuneBuff(victim, GetComponent <Transform>("rune_buff/rune_buff_right"), ref m_runeBuffs[1]);
                    }
                }
            }
        }
    }
Beispiel #4
0
    private void OnGMLockClass(Event_ e)
    {
        var nc = proto;

        var c = (int)e.param1;
        var i = (int)e.param2;

        var ci = c > 0 ? ConfigManager.Get <CreatureInfo>(c) : null;

        m_lockedClass  = ci ? ci.ID : m_proto;
        m_lockedGender = ci ? ci.gender : m_gender;

        var w = m_lockedClass == m_proto && i < 1 ? null : WeaponInfo.GetWeapon(m_lockedClass, i);

        if (w == null || w.isEmpty)
        {
            m_lockedElementType = m_elementType;
        }
        else
        {
            var a = ConfigManager.Get <WeaponAttribute>(w.weaponItemId);
            m_lockedElementType = a == null ? m_elementType : (CreatureElementTypes)a.elementType;
        }

        Logger.LogDetail("Lock class <b><color=#66EECC>[weapon:{0}, gender:{1}, weaponItem:{2}, elementType:{3}]</color></b>", proto, gender, w != null && !w.isEmpty ? w.weaponItemId : -1, elementType);

        DispatchEvent("OnPostGmLockClass", Event_.Pop(nc == proto));
    }
Beispiel #5
0
    // 玩家模块总是最优先捕获游戏货币变化消息
    void _Packet_999(ScRoleInfo p)
    {
        p.role.CopyTo(ref m_roleInfo);

        m_proto             = m_roleInfo.roleProto;
        m_gender            = m_roleInfo.gender;
        m_coinCount         = m_roleInfo.coin;
        m_gemCount          = m_roleInfo.diamond;
        m_wishCoinCount     = m_roleInfo.wishCoin;
        m_petSummonStone    = m_roleInfo.summonStone;
        m_heartSoul         = m_roleInfo.mind;
        m_friendPoint       = m_roleInfo.friendShipPoint;
        m_classAvatar       = Creature.GetClassAvatarName(proto);
        m_unionContribution = m_roleInfo.unionContribution;

        GetSignBanSate();

        var oa = m_avatar;

        m_avatar = m_roleInfo.avatar;
        if (oa != m_avatar)
        {
            DispatchModuleEvent(EventAvatarChanged, oa, m_avatar);
            DispatchEvent(EventAvatarChanged, Event_.Pop(oa, m_avatar));  // Used for external listeners
        }

        moduleStory.OnRecvRoleInfo();
    }
Beispiel #6
0
    private void OnSetPosition(Event_ e)
    {
        if (master)
        {
            Vector3_ offset = Vector3_.zero;
            if (fightingPet)
            {
                offset = fightingPet.position - master.position;
            }
            var t = (ShowCreatureInfo.SizeAndPos)e.param1;
            master.position_            = t.pos;
            master.position             = t.pos;
            master.eulerAngles          = t.rotation;
            master.transform.localScale = Vector3.one * t.size;
            if (fightingPet)
            {
                fightingPet.position_ = master.position_ + offset;
            }
        }
        else
        {
            recordMasterPos = ((ShowCreatureInfo.SizeAndPos)e.param1).pos;
        }

        rankCamera.cullingMask |= (Layers.MASK_MODEL | Layers.MASK_WEAPON | Layers.MASK_JEWELRY);
        pvpCamera.cullingMask  |= (Layers.MASK_MODEL | Layers.MASK_WEAPON | Layers.MASK_JEWELRY);
    }
Beispiel #7
0
 private void OnCombatCameraMove(Event_ e)
 {
     if (Level.current is Level_PVE)
     {
         combatCameraMoving = (bool)e.param1;
     }
 }
Beispiel #8
0
 private void OnCreatureQuitState(Event_ e)
 {
     if (!m_inherit || e.param1 != e.param2)
     {
         Destroy();
     }
 }
Beispiel #9
0
 /// <summary>
 ///     当摄像机开始远离时
 /// </summary>
 public void OnCameraStartFarAway()
 {
     starRoot?.SafeSetActive(false);
     RemoveListener();
     Module_Awake.instance?.DispatchEvent(Module_Awake.Event_StartFarAwayNode, Event_.Pop(npcId));
     animEffect.SafeSetActive(false);
 }
Beispiel #10
0
 private void OnWindowDestory(Event_ e)
 {
     if (e.param1 != null && e.param1.Equals(WindowCache))
     {
         CollectModuleCallbacks(true);
     }
 }
Beispiel #11
0
    //Pre-Initialisation
    private void Awake()
    {
        //Timer for all events
        timer = 0.0f;

        countOfUsed   = 0;
        runEventTimer = false;


        //Hide all warning images
        foreach (var warningImage in warningImageLocation)
        {
            warningImage.gameObject.SetActive(false);
        }

        //Bubble sort
        for (int outerIndex = 0; outerIndex < events.Count; outerIndex++)
        {
            for (int innerIndex = 0; innerIndex < events.Count - 1; innerIndex++)
            {
                if (events[innerIndex].timeStamp > events[innerIndex + 1].timeStamp)
                {
                    Event_ tempHolder = null;

                    tempHolder = events[innerIndex];

                    events[innerIndex] = events[innerIndex + 1];

                    events[innerIndex + 1] = tempHolder;
                }
            }
        }
    }
    private void OnBattleEnterWatchState(Event_ e)
    {
        var isWatch = (bool)e.param1;

        m_autoParent.SafeSetActive(!isWatch);
        m_reviveButton.SafeSetActive(isWatch);
    }
    private void OnSetTexture(Event_ e)
    {
        if (e.param1 == null || (int)(e.param1) != ID)
        {
            return;
        }

        if (null == e.param2)
        {
            if (m_uiMeshRef > 0)
            {
                --m_uiMeshRef;
            }
            else
            {
                Logger.LogError($"m_uiMeshRef 引用异常");
            }
            m_uiMesh.SafeSetActive(m_uiMeshRef > 0);
        }
        else
        {
            ++m_uiMeshRef;
            m_uiMesh.SafeSetActive(m_uiMeshRef > 0);

            var bgArr = (RawImage[])e.param2;
            if (bgArr?.Length > 0)
            {
                SetTexture(bgArr[0].texture);
            }
            SetAddTexture(bgArr[0], bgArr?.Length > 1 ? bgArr[1] : null);
        }

        Logger.LogDetail($"SceneTextureMesh: <b>{name}</b> ref count set to <b>{m_uiMeshRef}</b>");
    }
Beispiel #14
0
    protected override void OnBecameVisible(bool oldState, bool forward)
    {
        moduleGlobal.ShowGlobalLayerDefault(1, false);

        HideOthers();
        if (modulePVP.opType == OpenWhichPvP.LolPvP)
        {
            moduleHome.DispatchEvent(Module_Home.EventSwitchCameraMode, Event_.Pop(CameraShowType.Rank));
        }
        else
        {
            moduleHome.DispatchEvent(Module_Home.EventSwitchCameraMode, Event_.Pop(CameraShowType.Pvp));
        }

        m_roleName.text = modulePlayer.roleInfo.roleName;
        m_level.text    = Util.Format("LV:{0}", modulePlayer.roleInfo.level);
        state           = State.Normal;

        switch (modulePVP.opType)
        {
        case OpenWhichPvP.FreePvP: SetFreePvpState(state, OpenWhichPvP.FreePvP); break;

        case OpenWhichPvP.LolPvP: moduleMatch.RepareRankData(); break;

        case OpenWhichPvP.FriendPvP: InvationISsend(); break;

        default: break;
        }
    }
Beispiel #15
0
    private void OnOtherLoadingState(Event_ e)
    {
        var show   = e.param1 == null || (bool)e.param1;
        var window = e.param2 as string;
        var delay  = e.param3 == null ? 0 : (float)e.param3;
        var mode   = e.param4 == null ? 0 : (int)e.param4;

        DelayEvents.Remove(m_delayEventID);

        if (!show)
        {
            m_curLoadingWindow?.Hide(false, !m_curLoadingWindow.Equals(m_defaultLoadingWindow));
        }
        else
        {
            if (delay <= 0f)
            {
                ShowLoadingWindow(window, mode);
            }
            else
            {
                m_delayEventID = DelayEvents.Add(() =>
                {
                    ShowLoadingWindow(window, mode);
                }, delay);
            }
        }
    }
Beispiel #16
0
    private void UpdateAwakeProgress(Event_ e)
    {
        if (!m_awakeRoot.activeSelf)
        {
            return;
        }

        var buff = e.param2 as Buff;

        if (buff == null)
        {
            return;
        }

        m_awakeBar.fillAmount = buff.infinity ? 1.0f : (float)buff.duration / buff.length;
        m_btnAwake.enabled    = buff.destroyed;

        if (m_btnAwake.enabled)
        {
            UpdateAwakeButtonState();
        }
        else
        {
            m_awakeCR.SetAlpha(1.0f);
            m_awakeBarCR.SetAlpha(1.0f);
        }
    }
Beispiel #17
0
    protected override void OnBecameVisible(bool oldState, bool forward)
    {
        moduleGlobal.ShowGlobalLayerDefault(-1, false);
        base.OnBecameVisible(oldState, forward);
        m_startLoad     = false;
        m_tweenComplete = false;
        m_tween.onComplete.AddListener(b =>
        {
            m_timeStamp     = Time.realtimeSinceStartup;
            m_tweenComplete = true;
            m_timer.gameObject.SetActive(true);
        });

        var matchInfo = Window.GetWindowParam <Window_FactionStart>().param1 as ScMatchInfo;

        if (matchInfo == null)
        {
            return;
        }
        ShowModels(matchInfo);
        var index = moduleFactionBattle.factionMatchInfo.infos.FindIndex(item => item.faction == (byte)Module_FactionBattle.Faction.Red);

        m_redEntry.BindData(matchInfo.infoList[index], moduleFactionBattle.factionMatchInfo.infos[index]);
        index = moduleFactionBattle.factionMatchInfo.infos.FindIndex(item => item.faction == (byte)Module_FactionBattle.Faction.Blue);
        m_blueEntry.BindData(matchInfo.infoList[index], moduleFactionBattle.factionMatchInfo.infos[index]);

        moduleHome.DispatchEvent(Module_Home.EventSwitchCameraMode, Event_.Pop(CameraShowType.Pvp));
    }
    private void OnReceiveDatingEvent(Event_ e)
    {
        EnumDatingNotifyType notifyType = (EnumDatingNotifyType)e.param1;

        switch (notifyType)
        {
        case EnumDatingNotifyType.RefreshRedDot:
            MarkRedDot((List <int>)e.param2);
            break;

        case EnumDatingNotifyType.ClickBuild:
            break;

        case EnumDatingNotifyType.ClickBuildDown:
            OnClickDown((Vector3)e.param2);
            break;

        case EnumDatingNotifyType.ClickBuildUp:
            OnClickUp((Vector3)e.param2);
            break;

        case EnumDatingNotifyType.OnEndDrag:
            OnEndDrag((Vector2)e.param2);
            break;

        default:
            break;
        }
    }
Beispiel #19
0
    public void interact()
    {
        if (ev == null)
        {
            foreach (Event_ e in data)
            {
                if (player.prefer >= e.reqMood && player.village_prefer >= e.village_reqMood)
                {
                    ev = e;
                    break;
                }
            }
        }

        if (ev != null)
        {
            ev.Dialog();

            if (!Canvas_.show)//the event is over
            {
                data.Remove(ev);
                ev = null;
            }
        }
        else
        {
            Debug.Log("No usable event");
        }
    }
Beispiel #20
0
    private void OnRefreshTask(Event_ e)
    {
        var taskid = (byte)e.param1;

        Logger.LogDetail("刷新任务:id=={0}", taskid);
        CheckHaveMission(taskid);
    }
Beispiel #21
0
    protected override void OnCreatureDead(Event_ e)
    {
        FightRecordManager.RecordLog <LogOnCreatureDied>(log =>
        {
            log.tag         = (byte)TagType.OnCreatureDied;
            log.isTeamMode  = modulePVE.isTeamMode;
            log.onlineCount = moduleTeam.onlineMembers?.Count ?? 0;
        });

        if (!modulePVE.isTeamMode)
        {
            base.OnCreatureDead(e);
        }

        var c = e.sender as Creature;

        if (c.creatureCamp == CreatureCamp.PlayerCamp)
        {
            bool allDead = m_teamMembers.Count > 0;
            foreach (var item in m_teamMembers)
            {
                if (item && !item.isDead)
                {
                    allDead = false;
                }
            }

            //全部死亡之后,设置怪物为无敌状态
            if (allDead)
            {
                SetAllMonsterInvincible(true);
                QuitState(BattleStates.Watch);
            }
        }
    }
Beispiel #22
0
        public HistoricalEventCollection(XDocument xdoc, World world)
            : base(xdoc, world)
        {
            foreach (var element in xdoc.Root.Elements())
            {
                var val = element.Value;
                int valI;
                Int32.TryParse(val, out valI);
                switch (element.Name.LocalName)
                {
                case "id":
                    break;

                case "start_year":
                    if (valI != -1)
                    {
                        StartYear = valI;
                    }
                    break;

                case "start_seconds72":
                    if (valI != -1)
                    {
                        StartSeconds = valI;
                    }
                    break;

                case "end_year":
                    if (valI != -1)
                    {
                        EndYear = valI;
                    }
                    break;

                case "end_seconds72":
                    if (valI != -1)
                    {
                        EndSeconds = valI;
                    }
                    break;

                case "event":
                    if (Event_ == null)
                    {
                        Event_ = new List <int>();
                    }
                    Event_.Add(valI);
                    break;

                case "type":
                    if (!Types.Contains(val))
                    {
                        Types.Add(val);
                    }
                    Type = Types.IndexOf(val);
                    break;
                }
            }
        }
Beispiel #23
0
    public void EnterState(BattleStates state)
    {
        var mask = ((int)state).ToMask();

        if (mask == stateMask)
        {
            return;
        }

        var old = stateMask;

        if (state > BattleStates.Ended)
        {
            m_stateMask |= mask;
        }
        else
        {
            if (m_ns > 0)
            {
                QuitState(m_ns);
            }
            m_stateMask |= mask;

            m_ns = state;
        }

        if ((old & mask) == 0)
        {
            #if DEVELOPMENT_BUILD || UNITY_EDITOR
            Logger.LogInfo("[{3}], Level [{0}] enter state [{1}] from mask {2}.", name, state, old, levelTime);
            #endif

            m_stateTimers[(int)state] = 0;
            OnEnterState(old, state);

            if (state == BattleStates.Prepare)
            {
                DispatchEvent(LevelEvents.PREPARE, Event_.Pop(prepareEffect));
            }
            if (state == BattleStates.Fighting)
            {
                DispatchEvent(LevelEvents.START_FIGHT);
            }
            if (state == BattleStates.Ended)
            {
                DispatchEvent(LevelEvents.BATTLE_END);
            }
            if (state == BattleStates.Watch)
            {
                DispatchEvent(LevelEvents.BATTLE_ENTER_WATCH_STATE, Event_.Pop(true));

                var target = GetWatchTarget(player);
                if (target != null)
                {
                    Camera_Combat.current.SetFollowTransform(target.transform);
                }
            }
        }
    }
Beispiel #24
0
    private void SwitchShot(ref ShotState shotState, bool checkCut = true, bool forceCut = false)
    {
        var cut = forceCut || shotState.forceCut || checkCut && m_prevShot.blend.blendType == CameraBlendType.Cut;

        m_prevShot = shotState;

        if (m_shotInfo)
        {
            m_nextShot = m_shotInfo.GetSortedShotState(m_shotIndex);
        }
        if (m_nextShot.isEmpty)
        {
            m_nextShot = m_prevShot.time < 1.0f ? m_initEndState : m_prevShot;
        }

        if (!m_creature.isForward)
        {
            m_prevShot.Inverse();
            m_nextShot.Inverse();
        }

        euler  = m_prevShot.euler;
        offset = m_prevShot.offset;

        m_overrideSmooth = m_prevShot.overrideSmooth;

        m_camera.fieldOfView = m_prevShot.fieldOfView;

        m_currentShot.Set(offset, euler, m_prevShot.blend.blendType);

        removeCameraEdge = m_prevShot.removeCameraEdge;
        if (!removeCameraEdge)
        {
            m_forceRecalculateEdge = true;
        }

        if (Level.ShowHideSceneObjects(!m_prevShot.hideScene) && !m_prevShot.hideScene && m_drawMask < 1)
        {
            m_fading    = true;
            m_fadeStart = 1.0f;
            m_fadeEnd   = 0;
            m_fadeTime  = 0;

            m_overrideFadeDuration = CombatConfig.smaskFadeDuration;

            if (m_maskMaterial)
            {
                m_maskMaterial.SetColor(m_colorID, Color.black);
            }
        }

        if (cut)
        {
            UpdatePosition(false);
            UpdateRotation(false);
        }

        Root.instance.DispatchEvent(Events.CAMERA_SHOT_UI_STATE, Event_.Pop(m_prevShot.hideCombatUI, m_prevShot.maskAsset, m_prevShot.maskDuration));
    }
    private void OnStartCloseToNode(Event_ e)
    {
        moduleGlobal.ShowGlobalLayerDefault(-1, false);

        _detailWindow.UnInitialize();

        _root.SafeSetActive(false);
    }
Beispiel #26
0
        public async Task PostEvent_Async([FromBody] Event_ event_)
        {
            User user = await _context.Users.FirstOrDefaultAsync(o => o.Email == event_.OwnerId);

            event_.OwnerId = user.Id;
            _context.Events.Add(event_);
            await _context.SaveChangesAsync();
        }
Beispiel #27
0
	private void SpawnObstacle(Event_ eve){
		string[] words = eve.m_param.Split(' ');
		float h = (float)Helper_.ConvertStringtoFloat(words[0]);
		int size = Helper_.ConvertStringtoInt(words[1]);
		float coolTime = (float)Helper_.ConvertStringtoFloat(words[2]); 
		string kind = words[3];	
		StartCoroutine(SpawnObstacle(new Vector3(screenSize.x, screenSize.y * h, 0), size, coolTime, kind));
	}
Beispiel #28
0
 private void OnFocusStateChange(Event_ e)
 {
     m_focus = (bool)e.param1;
     if (!m_focus)
     {
         m_initStamp = false;
     }
 }
Beispiel #29
0
    private void OnBattleTimer(Event_ e)
    {
        var sec = (int)e.param1;

        m_timeInfinityObj.SetActive(sec < 0);
        m_battleTimer.gameObject.SetActive(sec >= 0);
        m_battleTimer.text = sec.ToString();
    }
Beispiel #30
0
 public void DispatchEvent(string name, Event_ e = null, bool pool = true)
 {
     _DispatchEvent(name, ref pool, ref e);
     if (pool && e != null)
     {
         Event_.Back(e);
     }
 }
Beispiel #31
0
 private void OnCreatureRealDead(Event_ e)
 {
     if (m_isPvE)
     {
         return;
     }
     DefaultEndState();
 }
Beispiel #32
0
	public void Spwan(Event_ eve){
		switch(eve.m_event){
			case "SpawnFeedFish":
				SpawnFeedFish(eve);
			break;	
		
			case "SpawnEnemyFish":
				SpawnEnemyFish(eve);
			break;
						
			case "SpawnObstacle":
				SpawnObstacle(eve);
			break;
			
			case "EndOfChunk":
			break;
		}
	}
Beispiel #33
0
	public void MakeEvent(Event_ eve){
		m_spawner.Spwan(eve);
	}