Exemplo n.º 1
0
    public void RoleStartEnterGame(int rIndex, bool isFirstEnter = false)
    {
        Game.WillEnterGame();

        rIndex = Mathf.Clamp(rIndex, 0, roleList.Length - 1);

        var p = PacketObject.Create <CsEnterGame>();

        p.roleId        = roleList[rIndex].roleId;
        p.gameVersion   = Launch.Updater.currentVersion;
        p.sourceHash    = AssetBundles.AssetManager.dataHash;
        p.machineNumber = SystemInfo.deviceUniqueIdentifier;
        p.producer      = SystemInfo.deviceModel;
        session.Send(p);

        PlayerPrefs.SetString(lastEnterRoleSaveKey, p.roleId.ToString());
        PlayerPrefs.Save();

        if (!isFirstEnter)
        {
            Game.GoHome();
        }

        DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.SELECT_ROLE, roleList[rIndex].roleId));
    }
Exemplo n.º 2
0
    void _Packet(ScFatigueRemainTimes p)
    {
        m_remainTime  = (long)p.remainTimes;
        m_recevieTime = Time.realtimeSinceStartup;

        DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.LOCAL_NOTIFY, SwitchType.Fatigue));
    }
Exemplo n.º 3
0
 public void Update()
 {
     try
     {
         SDKEvent sdkEvent = null;
         if (SDKTool.Singleton.PopEvent(out sdkEvent))
         {
             switch (sdkEvent.Type)
             {
             case EnumSDKEventType.eSDKEventType_Install_Success:
                 //开始播放视频
                 Debug.Log("播放视频");
                 //EventDelegate.Execute(this.m_installSuccess);
                 if (Application.isMobilePlatform)
                 {
                     ClientGameStateManager.singleton.ChangeGameState("UpdateState");
                 }
                 break;
             }
         }
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }
Exemplo n.º 4
0
    void _Packet(ScSkillInfo p)
    {
        p.CopyTo(ref skillInfo);

        OnGetAllSkillData();
        //OnAddDataToSkillLvDic();
        OnAddDataToSkillStateDic();

        DispatchModuleEvent(EventUpdateSkillPanel);

        DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.LOCAL_NOTIFY, SwitchType.SkillPoint));
    }
Exemplo n.º 5
0
    void _Packet(ScSkillPointRemainTimes p)
    {
        if (p.remainTimes == 0)
        {
            return;
        }
        m_recevieTime = Time.realtimeSinceStartup;
        m_remainTime  = p.remainTimes;

        if (skillInfo != null)
        {
            DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.LOCAL_NOTIFY, SwitchType.SkillPoint));
        }
    }
Exemplo n.º 6
0
    private void SetSwitchState()
    {
        if (switchInfo == null || switchInfo.Length < 1)
        {
            return;
        }
        for (int i = 0; i < switchInfo.Length; i++)
        {
            var _id = switchInfo[i].switchId;
            if (_id == 0)
            {
                continue;
            }

            var type  = (SwitchType)_id;
            var state = switchInfo[i].value;
            if (m_pushState.ContainsKey(type))
            {
                m_pushState[type] = state;
                continue;
            }
            m_pushState.Add(type, state);

            if (type == SwitchType.UnionBoss)
            {
                DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.UNION_CHANGE, modulePlayer.roleInfo.leagueID, state));
            }

            if (type == SwitchType.UnionBoss || type == SwitchType.SystemPao)
            {
                continue;
            }

            if (type == SwitchType.Labyrinth || type == SwitchType.SkillPoint || type == SwitchType.RoyalPvp)
            {
                var _type = type == SwitchType.Labyrinth ? HomeIcons.Labyrinth : type == SwitchType.RoyalPvp ? HomeIcons.Match : HomeIcons.Skill;
                var canIn = moduleGuide.IsActiveFunction(_type);
                if (!canIn)
                {
                    continue;
                }
            }

            DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.TAG, state, _id));
        }
    }
Exemplo n.º 7
0
    void _Packet(ScSystemChangeSwitch p)
    {
        if (p.result == 0)
        {
            var type = (SwitchType)p.switchId;
            if (m_pushState.ContainsKey(type))
            {
                m_pushState[type] = p.value;

                if (type != SwitchType.UnionBoss && type != SwitchType.SystemPao)
                {
                    var canIn = true;
                    if (type == SwitchType.Labyrinth || type == SwitchType.SkillPoint || type == SwitchType.RoyalPvp)
                    {
                        var _type = type == SwitchType.Labyrinth ? HomeIcons.Labyrinth : type == SwitchType.RoyalPvp ? HomeIcons.Match : HomeIcons.Skill;
                        canIn = moduleGuide.IsActiveFunction(_type);
                    }
                    if (canIn)
                    {
                        DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.TAG, p.value, p.switchId));
                    }
                }

                if (type == SwitchType.Fatigue || type == SwitchType.SkillPoint)
                {
                    DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.LOCAL_NOTIFY, type));
                }

                if (type == SwitchType.UnionBoss)
                {
                    DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.UNION_CHANGE, modulePlayer.roleInfo.leagueID, p.value));
                }
            }
            DispatchModuleEvent(EventSavePushState);
        }
        else
        {
            moduleGlobal.ShowMessage(Util.GetString(9212, 8));
        }
    }
Exemplo n.º 8
0
    void _ME(ModuleEvent <Module_Guide> e)
    {
        if (e.moduleEvent == Module_Guide.EventUnlockFunctionStart)
        {
            var ids = e.param1 as int[];
            if (ids == null && ids.Length < 1)
            {
                return;
            }

            for (int i = 0; i < ids.Length; i++)
            {
                var type  = (HomeIcons)ids[i];
                var _type = SwitchType.Fatigue;

                if (type == HomeIcons.Labyrinth)
                {
                    _type = SwitchType.Labyrinth;
                }
                else if (type == HomeIcons.Match)
                {
                    _type = SwitchType.RoyalPvp;
                }
                else if (type == HomeIcons.Skill)
                {
                    _type = SwitchType.SkillPoint;
                }
                else if (type == HomeIcons.Guild)
                {
                    _type = SwitchType.UnionBoss;
                }

                if (_type != SwitchType.Fatigue && moduleSet.pushState.ContainsKey(_type) && moduleSet.pushState[_type] == 1)
                {
                    DispatchEvent(SDKEvent.GLOBAL, SDKEvent.PopSdk(SDKEvent.TAG, (uint)1, (byte)_type));
                }
            }
        }
    }
 public void Update()
 {
     try
     {
         SDKEvent sdkEvent = null;
         if (SDKTool.Singleton.PopEvent(out sdkEvent))
         {
             switch (sdkEvent.Type)
             {
             case EnumSDKEventType.eSDKEventType_Install_Success:
                 //开始播放视频
                 Debug.Log("播放视频");
                 EventDelegate.Execute(this.m_installSuccess);
                 break;
             }
         }
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Video management events from Cayuga SDK
        /// </summary>
        private void OnvideoManager_VideoManagement(SDKEvent evt)
        {
            SDKVideoManager videoManager = SDKVideoManagerFactory.GetManager();
            var             timestamp    = evt.TimeStamp;
            var             sourceID     = evt.SourceID;
            var             entity       = videoManager.GetEntity(MainWindow.ConnectedInstallationID, sourceID);
            var             cause        = videoManager.GetEntity(MainWindow.ConnectedInstallationID, evt.CauseID);

            if (evt.EventType == SDKEventType.CMVideoSourceNotAvailable) //VideoLoss, only defined for "cable not connected"
            {
                this.SendAlarm("1", timestamp, entity.Name, "Video Loss");
                MainWindow.NotReachableCameras.Add(sourceID);
            }
            else if (evt.EventType == SDKEventType.AlarmRecordingStart)
            {
                this.SendAlarm("9", timestamp, entity.Name, "Alarm Recording Start");
            }
            else if (evt.EventType == SDKEventType.AlarmRecordingStop)
            {
                this.SendAlarm("10", timestamp, entity.Name, "Alarm Recording Stop");
            }
            else if (evt.EventType == SDKEventType.AlarmTriggered)
            {
                this.SendAlarm("7", timestamp, entity.Name, "Alarm scenario started");
            }
            else if (evt.EventType == SDKEventType.EntityStatusChanged)
            {
                if (videoManager.IsSubType(SDKEntityType.VideoSource, entity.EntityType) &&
                    entity.Status == 0 &&
                    MainWindow.NotReachableCameras.Contains(sourceID))
                {
                    this.SendAlarm("2", timestamp, entity.Name, "Video Reconnect");
                    MainWindow.NotReachableCameras.Remove(sourceID);
                }
                else if (entity.EntityType == SDKEntityType.RuntimeDM && entity.Status == 0 && DMandMDSwithFailure.Contains(sourceID)) //only when DM was offline at first
                {
                    this.SendAlarm("5", timestamp, entity.Name, "Recording Server Online (DM)");
                    MainWindow.DMandMDSwithFailure.Remove(sourceID);
                }
                else if (entity.EntityType == SDKEntityType.RuntimeMDB && entity.Status == 0 && DMandMDSwithFailure.Contains(sourceID)) //only when DM was offline at first
                {
                    this.SendAlarm("5", timestamp, entity.Name, "Recording Server Online (MDS)");
                    MainWindow.DMandMDSwithFailure.Remove(sourceID);
                }
            }
            else if (evt.EventType == SDKEventType.MDBZoneAlmostFull)
            {
                this.SendAlarm("3", timestamp, entity.Name, "MDS zone is almost full");
            }
            else if (evt.EventType == SDKEventType.REInvalidStatus || evt.EventType == SDKEventType.CMCannotStart || evt.EventType == SDKEventType.EntityDeregistered || evt.EventType == SDKEventType.MDBCannotStartMDS)
            {
                if (entity.EntityType == SDKEntityType.RuntimeDM && !DMandMDSwithFailure.Contains(sourceID))
                {
                    this.SendAlarm("6", timestamp, entity.Name, "Recording Server Offline (DM)");
                    MainWindow.DMandMDSwithFailure.Add(sourceID);
                }
                else if (entity.EntityType == SDKEntityType.RuntimeMDB && !DMandMDSwithFailure.Contains(sourceID))
                {
                    this.SendAlarm("6", timestamp, entity.Name, "Recording Server Offline (MDS)");
                    MainWindow.DMandMDSwithFailure.Add(sourceID);
                }
            }
        }