Exemplo n.º 1
0
 /// <summary>
 /// 自动播放背景音效
 /// </summary>
 public void AutoPlayBGM()
 {
     if (!GameCenter.systemSettingMng.OpenMusic)
     {
         return;
     }
     //因为场景配表中没有对应的场景,所以登录子状态的背景音乐只能按状态硬编码
     if (GameCenter.curGameStage is LoginStage || GameCenter.curGameStage is CharacterSelectStage || GameCenter.curGameStage is CharacterCreateStage)
     {
         mySoundPlayer.PlayBGM("music/denglu.mp3");
     }
     else
     {
         int      sceneID  = GameCenter.mainPlayerMng.MainPlayerInfo.SceneID;
         SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(sceneID);
         if (sceneRef != null)
         {
             mySoundPlayer.PlayBGM(sceneRef.music.ToString());
         }
         else
         {
             mySoundPlayer.PlayBGM("music/zhucheng.mp3");
         }
     }
 }
Exemplo n.º 2
0
    protected void InitMapCamera(int _sceneIndex, System.Action _callBack)
    {
        if (mapCamera == null)
        {
            return;
        }
        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(_sceneIndex);

        if (sceneRef == null)
        {
            return;
        }
        mapCamera.transform.localPosition = new Vector3(sceneRef.sceneWidth / 2.0f, 5, sceneRef.sceneLength / 2.0f);
        mapCamera.orthographicSize        = sceneRef.sceneLength / 2.0f;
        mapCamera.gameObject.SetActive(true);
        mapCamera.aspect      = sceneRef.sceneWidth / sceneRef.sceneLength;
        mapCamera.enabled     = true;
        mapCamera.cullingMask = LayerMng.GetLayerMask(LayerMaskType.LogicMap);
        if (curLogicMapTex2D != null)
        {
            DestroyImmediate(curLogicMapTex2D, true);
            curLogicMapTex2D = null;
        }
        StartCoroutine(CaptureByCamera(mapCamera, new Rect(0, 0, sceneRef.sceneWidth, sceneRef.sceneLength), (x) =>
        {
            curLogicMapTex2D = x;
            mapCamera.gameObject.SetActive(false);
            mapCamera.enabled = false;
            if (_callBack != null)
            {
                _callBack();
            }
        }));
    }
Exemplo n.º 3
0
 /// <summary>
 /// 自动播放背景音效
 /// </summary>
 public void AutoPlayBGM()
 {
     //因为场景配表中没有对应的场景,所以登录子状态的背景音乐只能按状态硬编码
     if (!GameCenter.systemSettingMng.OpenMusic)
     {
         return;
     }
     if (GameCenter.curGameStage is LoginStage || GameCenter.curGameStage is CharacterSelectStage || GameCenter.curGameStage is CharacterCreateStage)
     {
         PlayBGM("music/denglu.mp3");
     }
     else
     {
         int      sceneID  = GameCenter.mainPlayerMng.MainPlayerInfo.SceneID;
         SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(sceneID);
         if (sceneRef != null && sceneRef.sort != SceneType.CITY)
         {
             PlayBGM(sceneRef.music.ToString());
         }
         else
         {
             //string[] musics = new string[3]{"Music/zhucheng.mp3","Music/newzhucheng.mp3","Music/juqingtianjingpingdan.mp3"};
             //System.Random random = new System.Random();
             //int index = random.Next(0,3);
             PlayBGM("music/zhucheng.mp3");
         }
     }
 }
Exemplo n.º 4
0
    public void InitMainCamera(int _sceneID)
    {
        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(_sceneID);


        if (GameCenter.curMainPlayer != null)
        {
            currentCtrl.target = GameCenter.curMainPlayer.gameObject.transform;
        }
        currentCtrl.y           = sceneRef.cam_y;
        currentCtrl.aimY        = sceneRef.cam_y;
        currentCtrl.distance    = sceneRef.cam_distance;
        currentCtrl.aimDistance = sceneRef.cam_distance;
        currentCtrl.xMin        = sceneRef.cam_x_min;
        currentCtrl.xMax        = sceneRef.cam_x_max;
        currentCtrl.zMax        = sceneRef.cam_z_max;
        currentCtrl.zMin        = sceneRef.cam_z_min;

        nextCtrl.y           = sceneRef.cam_y;
        nextCtrl.distance    = sceneRef.cam_distance;
        nextCtrl.aimY        = sceneRef.cam_y;
        nextCtrl.aimDistance = sceneRef.cam_distance;
        nextCtrl.xMin        = sceneRef.cam_x_min;
        nextCtrl.xMax        = sceneRef.cam_x_max;
        nextCtrl.zMax        = sceneRef.cam_z_max;
        nextCtrl.zMin        = sceneRef.cam_z_min;


        //uiCamera.GetComponent<UICamera>().allowMultiTouch = sceneRef.sort == SceneType.DUNGEON;
    }
Exemplo n.º 5
0
        public static void AddedSceneInHistory(SceneRef scene)
        {
            if (!userLoadedScene)
            {
                if (sceneHistoryList.Count >= maxLength)
                {
                    sceneHistoryList.RemoveAt(0);
                    sceneHistoryList.Add(new SceneRef(SceneManager.GetActiveScene().path));
                }
                else
                {
                    sceneHistoryList.Add(new SceneRef(SceneManager.GetActiveScene().path));
                }
                Debug.Log("Added");
                string pathTmp = SceneManager.GetActiveScene().path;

                EditorSceneManager.SetActiveScene(EditorSceneManager.GetSceneByName(scene.Name));
                EditorSceneManager.CloseScene(EditorSceneManager.GetSceneByPath(pathTmp), true);
                cursor = sceneHistoryList.Count - 1;
            }
            else
            {
                /*if (sceneHistoryList.Count >= maxLength)
                 * {
                 *  sceneHistoryList.RemoveAt(0);
                 *  sceneHistoryList.Add(scene);
                 * }
                 * else
                 * {
                 *  sceneHistoryList.Add(scene);
                 * }
                 * cursor = sceneHistoryList.Count - 1;*/
            }
            userLoadedScene = false;
        }
Exemplo n.º 6
0
    void FlyToInMap()
    {
        int     sceneId = GameCenter.taskMng.seceneId;
        Vector3 target  = GameCenter.taskMng.flyVec;

        GameCenter.curMainPlayer.StopMovingTo();
        GameCenter.curMainPlayer.CancelCommands();
        GameCenter.curMainPlayer.GoNormal();
        if (sceneId == 0)
        {
            SceneRef scene = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;
            if (scene != null)
            {
                if (scene.allow_fly_by_pos_src == 1)
                {
                    GameCenter.mainPlayerMng.C2S_Fly_Pint(GameCenter.mainPlayerMng.MainPlayerInfo.SceneID, (int)target.x, (int)target.y);
                }
                else
                {
                    GameCenter.messageMng.AddClientMsg(86);
                }
            }
            //this.gameObject.SetActive(false);
        }
        else
        {
            GameCenter.mainPlayerMng.C2S_Fly_Pint(sceneId, (int)target.x, (int)target.z);
            //this.gameObject.SetActive(false);
        }
    }
Exemplo n.º 7
0
            public bool RenderProperty(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + this;

                if (_additionalLoadingObjects != null && _additionalLoadingObjects.Length > 0)
                {
                    label.text += " with " + GetAdditionalLoadingObjectsDescription();
                }

                label.text += ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);

                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;


                    _scene = SerializationEditorGUILayout.ObjectField(_scene, "Scene", ref dataChanged);
                    _additionalLoadingObjects = SerializationEditorGUILayout.ObjectField(_additionalLoadingObjects, "Additional Loading Objects", ref dataChanged);

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
Exemplo n.º 8
0
                public static object PropertyField(object obj, GUIContent label, ref bool dataChanged, GUIStyle style, params GUILayoutOption[] options)
                {
                    SceneRef sceneRef = (SceneRef)obj;

                    GUIContent[] sceneNames = new GUIContent[EditorBuildSettings.scenes.Length + 1];
                    string[]     scenePaths = new string[EditorBuildSettings.scenes.Length];

                    sceneNames[0] = new GUIContent("(No Scene)");

                    int currIndex = 0;

                    for (int i = 0; i < EditorBuildSettings.scenes.Length; i++)
                    {
                        EditorBuildSettingsScene editorScene = EditorBuildSettings.scenes[i];
                        sceneNames[i + 1] = new GUIContent(SceneUtils.GetSceneNameFromPath(editorScene.path));
                        scenePaths[i]     = editorScene.path;

                        if (editorScene.path == sceneRef.GetScenePath())
                        {
                            currIndex = i + 1;
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    currIndex = EditorGUILayout.Popup(label, currIndex, sceneNames);
                    if (EditorGUI.EndChangeCheck())
                    {
                        sceneRef    = new SceneRef(currIndex == 0 ? null : scenePaths[currIndex - 1]);
                        dataChanged = true;
                    }

                    return(sceneRef);
                }
Exemplo n.º 9
0
    protected void S2C_OnLoginInGame(Pt _info)
    {
        pt_req_load_scene_b104 pt = _info as pt_req_load_scene_b104;

        if (GameCenter.sceneMng != null)
        {
            GameCenter.sceneMng.isChangingScene = true;//切换场景此时不能发送上马协议
        }
        mainPlayerInfo.EnterScene(pt);
        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef((int)pt.scene);

        if (sceneRef != null)
        {
            switch (sceneRef.sort)
            {
            case SceneType.CITY:
                GameCenter.instance.GoInitCity();    //如果是主城
                break;

            case SceneType.DUNGEONS:
            case SceneType.PEACEFIELD:
            case SceneType.SCUFFLEFIELD:
            case SceneType.CAMPFIELD:
            case SceneType.ENDLESS:
            case SceneType.MULTIPLE:
            case SceneType.ARENA:
                GameCenter.instance.GoInitDungeon();    //如果是地下城
                break;
            }
        }
    }
Exemplo n.º 10
0
 void ISerializationCallbackReceiver.OnAfterDeserialize()
 {
     //exists for backwards compatability
     if (!string.IsNullOrEmpty(_sceneName))
     {
         _scene     = new SceneRef(_sceneName);
         _sceneName = null;
     }
 }
Exemplo n.º 11
0
    void Refresh()
    {
        targetID = GameCenter.taskMng.CurTargetID;
        sceneId  = GameCenter.taskMng.CurTargetSceneID;
        point    = GameCenter.taskMng.CurTargetPoint;
        SceneRef scene = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;

        if (scene != null)
        {
            if (GameCenter.vipMng.VipData != null && GameCenter.vipMng.VipData.vLev > 0 || (GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel >= 10 && GameCenter.mainPlayerMng.MainPlayerInfo.RealYuanCount >= 10))
            {
                effctBink.SetActive(true);
            }
            else
            {
                effctBink.SetActive(false);
            }
            if (GameCenter.vipMng.VipData != null && GameCenter.vipMng.VipData.vLev > 0)
            {
                under10LevRemind.SetActive(false);
                under20LevRemind.SetActive(false);
            }
            else
            {
                if (GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel < 10)
                {
                    under10LevRemind.SetActive(true);
                    under20LevRemind.SetActive(false);
                }
                else if (GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel <= 20)
                {
                    under10LevRemind.SetActive(false);
                    under20LevRemind.SetActive(true);
                }
                else
                {
                    under10LevRemind.SetActive(false);
                    under20LevRemind.SetActive(false);
                }
            }
            if (scene.id == sceneId)
            {
                if (flyBtn != null && isOpen)
                {
                    flyBtn.gameObject.SetActive(scene.allow_fly_by_pos_src == 1);
                }
            }
            else
            {
                if (flyBtn != null && isOpen)
                {
                    flyBtn.gameObject.SetActive(scene.allow_fly_by_pos_dest == 1);
                }
            }
        }
    }
Exemplo n.º 12
0
    void GoFirst(GameObject go)
    {
        //GameCenter.activityMng.C2S_FlyHangUpCoppy(160011);
        SceneRef sceneRef = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;

        if (sceneRef != null)
        {
            GameCenter.curMainPlayer.GoTraceTarget(sceneRef.id, sceneRef.out_x, sceneRef.out_z);//二层去一层,取二层的出口
        }
    }
Exemplo n.º 13
0
 public GameObjectRef(eSourceType sourceType)
 {
     _sourceType      = sourceType;
     _objectName      = string.Empty;
     _scene           = new SceneRef();
     _sceneObjectID   = -1;
     _prefab          = new AssetRef <GameObject>();
     _gameObject      = null;
     _sourceObject    = null;
     _editorCollapsed = false;
 }
Exemplo n.º 14
0
    protected virtual void EnterTargetState(fsm.State _from, fsm.State _to, fsm.Event _event)
    {
        curEventType = EventType.TARGET;
        thisTarget   = null;
        float distance = 0;

        curTarTaskInfo = GameCenter.taskMng.CurfocusTask;

        SceneRef sceneRef = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;

        if (sceneRef != null && sceneRef.pk_mode != 0)       //强制玩家切换PK模式的场景里,才锁定玩家 by邓成
        {
            thisTarget = GameCenter.curGameStage.GetClosestPlayer(thisPlayer, RelationType.AUTOMATEDATTACKS, ref distance);
            if (distance > autoFightDistance)
            {
                thisTarget = null;
            }
        }
        else
        {
            thisTarget = GameCenter.curGameStage.GetClosestMob(thisPlayer, ref distance);
            if (distance > autoFightDistance)
            {
                thisTarget = null;
            }
            if (curTarTaskInfo != null && thisTarget != null)
            {
                Monster mob = thisTarget as Monster;
                if (mob == null)
                {
                    thisTarget = null;
                }
//				else if (curTarTaskInfo.TargetMosterID != mob.ConfigID)   //这里需要TargetMosterID和ConfigID
//				{
//					thisTarget = null;
//				}
            }
            if (thisTarget != null)//自动战斗避开BOSS  BY黄洪兴
            {
                Monster mo = thisTarget as Monster;
                if (mo != null && GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef != null)
                {
                    if (GameCenter.systemSettingMng.IsHideBoss && mo.actorInfo.IsBoss && GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef.sort == SceneType.SCUFFLEFIELD)
                    {
                        thisTarget = null;
                    }
                }
            }
        }
        if (thisTarget == null)
        {
            ChangeTarget();
        }
    }
Exemplo n.º 15
0
    void ShowRelive()
    {
        SceneRef sceneRef = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;

        if (sceneRef != null)
        {
            if (labAlive != null)
            {
                labAlive.text = GameCenter.dungeonMng.DungeonReliveTimes + "/" + sceneRef.reviveNum;
            }
        }
    }
Exemplo n.º 16
0
    void InitWnd()
    {
        GameCenter.activityMng.C2S_ReqProtectActivityRank();
        ShowTime();
        ShowWave();
        ShowMonsterNum();
        SceneRef sceneRef = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;

        if (labDifficulty != null)
        {
            labDifficulty.text = sceneRef == null?string.Empty:sceneRef.name;
        }
    }
Exemplo n.º 17
0
    void SpecificGuidelines()
    {
        //Debug.Log("打开特殊引导");
        TaskInfo task    = GameCenter.taskMng.GetMainTaskInfo();
        int      sceneID = GameCenter.curGameStage.SceneID;

        //判断主线任务和任务步骤以及场景和是否已经创建角色确定弹出欢迎界面
        if (task != null && task.Task == 1 && task.Step == 1 && sceneID == 100011)
        {
            if (GameCenter.loginMng.isCreatePlayer)
            {
                GameCenter.uIMng.SwitchToUI(GUIType.WELCOME);
                GameCenter.loginMng.isCreatePlayer = false;
            }
            else
            {
                GameCenter.noviceGuideMng.OpenGuide(100024, 1);//任务引导点击执行任务
            }
            return;
        }
        //红名小王子 引导PK
        if (sceneID == 160007)
        {
            GameCenter.curMainPlayer.GoHoldOn();
            GameCenter.curMainPlayer.StopForCheckMsg();
//			GameCenter.curMainPlayer.GoAutoFight();
            GameCenter.noviceGuideMng.OpenGuide(100023, 1);
            GameCenter.uIMng.SwitchToSubUI(SubGUIType.PKTIP);
            return;
        }
        //花果山场景 挂机引导
        else if (sceneID == 160005)
        {
            GameCenter.curMainPlayer.GoHoldOn();
            GameCenter.curMainPlayer.StopForCheckMsg();
//			GameCenter.curMainPlayer.GoAutoFight();
            GameCenter.noviceGuideMng.OpenGuide(100021, 1);
//			isOpenGuide = false;
//			GameCenter.endLessTrialsMng.OnOpenCoppyTime -= OpenCoppyTime;
//			GameCenter.endLessTrialsMng.OnOpenCoppyTime += OpenCoppyTime;
            return;
        }
        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(sceneID);

        if (GameCenter.endLessTrialsMng.IsFastClearance && (sceneRef.sort == SceneType.PEACEFIELD || sceneRef.sort == SceneType.CAMPFIELD || sceneRef.sort == SceneType.SCUFFLEFIELD))
        {
            GameCenter.endLessTrialsMng.IsFastClearance = false;
            GameCenter.noviceGuideMng.OpenGuide(100018, 1);
            return;
        }
    }
Exemplo n.º 18
0
    void GoSecond(GameObject go)
    {
        if (GameCenter.mainPlayerMng.MainPlayerInfo.VipLev < 2)
        {
            GameCenter.messageMng.AddClientMsg(154);
            return;
        }
        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(160012);

        if (sceneRef != null)
        {
            GameCenter.curMainPlayer.GoTraceTarget(160012, sceneRef.in_x, sceneRef.in_z);//一层去二层,取一层的入口
        }
    }
Exemplo n.º 19
0
    /// <summary>
    /// 相机跳转
    /// </summary>
    /// <param name="_target"></param>
    /// <param name="_duration"></param>
    public void FocusOn(InteractiveObject _target, float _x, float _y, float _distance, float _duration = 0.5f)
    {
        if (_target == null)
        {
            return;
        }
        StopCrossFade();
        curTarget = _target;
        if (currentCtrl.enabled && currentCtrl.target == _target.gameObject.transform)
        {
            return;
        }
        nextCtrl.gameObject.SetActive(true);
        nextCtrl.target      = _target.gameObject.transform;
        nextCtrl.aimDistance = _distance;
        nextCtrl.maxDistance = 100;
        nextCtrl.minDistance = 0;
        nextCtrl.aimY        = _y;
        nextCtrl.yMaxLimit   = 360.0f;
        nextCtrl.yMinLimit   = -360.0f;
        nextCtrl.x           = _x;
        nextCtrl.xMin        = -360.0f;
        nextCtrl.xMax        = 360.0f;
        srcCamPosition       = curCamPosition;
        srcCamRotation       = curCamRotation;

        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(GameCenter.curGameStage.SceneID);

        if (sceneRef != null)
        {
            currentCtrl.y           = sceneRef.cam_y;
            currentCtrl.aimY        = sceneRef.cam_y;
            currentCtrl.distance    = sceneRef.cam_distance;
            currentCtrl.aimDistance = sceneRef.cam_distance;
            currentCtrl.xMin        = sceneRef.cam_x_min;
            currentCtrl.xMax        = sceneRef.cam_x_max;
            currentCtrl.zMax        = sceneRef.cam_z_max;
            currentCtrl.zMin        = sceneRef.cam_z_min;
        }

        CorrectCameraNow();


        CrossFade(currentCtrl, nextCtrl, _duration);
    }
Exemplo n.º 20
0
    void ShowSimpleReward()
    {
        if (mLev != null)
        {
            mLev.text = GameCenter.mainPlayerMng.MainPlayerInfo.LevelDes;
        }
        float val = ((float)GameCenter.mainPlayerMng.MainPlayerInfo.CurExp / (float)GameCenter.mainPlayerMng.MainPlayerInfo.MaxExp);

        mExps.value = val;
        int valt = (int)(val * 10000);

        mExp.text = valt / 100f + "%";
        SceneRef scene = ConfigMng.Instance.GetSceneRef(GameCenter.mainPlayerMng.MainPlayerInfo.SceneID);

        twoStarTime.text   = scene.starTime2.ToString();
        threeStarTime.text = scene.starTime3.ToString();
        twoStarTime.transform.parent.gameObject.SetActive(scene.starTime3 > 0);
    }
Exemplo n.º 21
0
    protected override void OnOpen()
    {
        base.OnOpen();
        ShowTime();
        ShowWave();
        SceneRef scene = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef;

        if (scene != null)
        {
            if (normalWave != null)
            {
                normalWave.SetActive(scene.uiType == (int)SceneUiType.BRIDGE && scene.id != 110311);
            }
            if (specialWave != null)
            {
                specialWave.SetActive(scene.uiType == (int)SceneUiType.BRIDGE && scene.id == 110311);
            }
        }
    }
Exemplo n.º 22
0
    public void StartLoadResources(string _sceneName, int _sceneIndex, Action _callBack)
    {
        string mainPath = AssetMng.GetPathWithoutExtension("scene/", AssetPathType.PersistentDataPath);

        //获取本次所需要的所有特效名称
        List <string> wholeNeedNames = new List <string>();

        SceneRef refData = ConfigMng.Instance.GetSceneRef(_sceneIndex);

        if (refData != null)
        {
            wholeNeedNames.Add(refData.replaceNavmesh);
        }

        wholeNeedNames.Add(_sceneName);


        StartCoroutine(LoadResources(mainPath, wholeNeedNames, _callBack, true));
    }
Exemplo n.º 23
0
    /// <summary>
    /// 加载掩码 by吴江
    /// </summary>
    /// <param name="_sceneName"></param>
    /// <param name="_sceneIndex"></param>
    /// <param name="_callBack"></param>
    public void StartLoadMapConfig(string _sceneName, int _sceneIndex, Action _callBack)
    {
        SceneRef sceneRef = ConfigMng.Instance.GetSceneRef(_sceneIndex);

        if (sceneRef != null)
        {
            string mainPath = AssetMng.GetPathWithoutExtension("scene/", AssetPathType.PersistentDataPath);
            StartCoroutine(LoadMapConfig(mainPath, sceneRef.replaceNavmesh, () =>
            {
                if (_callBack != null)
                {
                    _callBack();
                }
            }));
        }
        else
        {
            Debug.LogError("场景 " + _sceneName + "的配置文件找不到!");
        }
    }
Exemplo n.º 24
0
 public SceneLoadingInfo(SceneRef scene)
 {
     _scene = scene;
     _additionalLoadingObjects = null;
 }
Exemplo n.º 25
0
 public SceneLoadingInfo(SceneRef scene, GameObjectLoader.Ref[] additionalLoadingObjects)
 {
     _scene = scene;
     _additionalLoadingObjects = additionalLoadingObjects;
 }
Exemplo n.º 26
0
 public SceneLoadingInfo(string scenePath)
 {
     _scene = new SceneRef(scenePath);
     _additionalLoadingObjects = null;
 }
Exemplo n.º 27
0
 public SceneLoadingInfo()
 {
     _scene = new SceneRef();
     _additionalLoadingObjects = null;
 }
Exemplo n.º 28
0
    void OnCurChapterItemUpdate()
    {
        if (data == null)
        {
            return;
        }
        if (Icon != null)
        {
            Icon.spriteName = data.icon;
            Icon.MakePixelPerfect();
        }
        if (name != null)
        {
            name.text = data.name;
        }
        if (fight != null)
        {
            fight.text = data.fighting;
        }

        bool isShow = (data.frontGate > 0 && !GameCenter.endLessTrialsMng.GetItemDataFront(data.frontGate));

        if (unShow != null)
        {
            unShow.GetComponent <UISpriteEx>().IsGray = isShow ? UISpriteEx.ColorGray.Gray : UISpriteEx.ColorGray.normal;
        }
//		BoxCollider box = gameObject.GetComponent<BoxCollider>();
//		if(box != null)box.enabled = !isShow;

        SceneRef scene = ConfigMng.Instance.GetSceneRef(data.id);

        if (scene != null)
        {
            for (int i = 0, len = items.Length; i < len; i++)
            {
                if (items[i] != null)
                {
                    if (i < scene.reward.Count)
                    {
                        items[i].FillInfo(new EquipmentInfo(scene.reward[i].eid, scene.reward[i].count, EquipmentBelongTo.PREVIEW));
                        items[i].gameObject.SetActive(true);
                    }
                    else
                    {
                        items[i].gameObject.SetActive(false);
                    }
                }
            }
        }
        for (int i = 0, len = oneItems.Length; i < len; i++)
        {
            if (oneItems[i] != null && i < data.firstAward.Count)
            {
                oneItems[i].FillInfo(new EquipmentInfo(data.firstAward[i].eid, data.firstAward[i].count, EquipmentBelongTo.PREVIEW));
                oneItems[i].gameObject.SetActive(true);
            }
            else
            {
                oneItems[i].gameObject.SetActive(false);
            }
        }

        if (btnReward != null)
        {
            UISpriteEx spEx = btnReward.GetComponentInChildren <UISpriteEx>();
            if (spEx != null)
            {
                spEx.IsGray = isShow ? UISpriteEx.ColorGray.Gray : UISpriteEx.ColorGray.normal;
            }
            UIEventListener.Get(btnReward.gameObject).onClick = delegate {
                GameCenter.endLessTrialsMng.C2S_InEndItem(GameCenter.endLessTrialsMng.CurChapterID, data.id);
            };
        }
        if (chapter != null)
        {
            chapter.text = data.chapterName;
        }
        if (isKill != null)
        {
            isKill.gameObject.SetActive(false);
        }
        if (flagSp != null)
        {
            flagSp.SetActive(false);
        }
        if (headSp != null)
        {
            headSp.SetActive(false);
        }
        EndLessTrialsDataInfo.EndLessTrialsItemData serData = GameCenter.endLessTrialsMng.GetItemData(data.id);
        if (serData == null)
        {
//			if(unShow != null)unShow.SetActive(true);
            if (killDes != null)
            {
                killDes.text = ConfigMng.Instance.GetUItext(9);
            }
            for (int i = 0, len = showStar.Length; i < len; i++)
            {
                if (showStar[i] != null)
                {
                    showStar[i].IsGray = UISpriteEx.ColorGray.Gray;
                }
            }
            if (!isShow)
            {
                if (headSp != null)
                {
                    headSp.SetActive(true);
                }
            }
            return;
        }
        if (isKill != null)
        {
            isKill.gameObject.SetActive(serData.enter > 0);
        }
        if (flagSp != null)
        {
            flagSp.SetActive(serData.star > 0 || serData.enter > 0);
        }
        if (killDes != null)
        {
            killDes.text = serData.ItemTime;
        }
        for (int i = 0, len = showStar.Length; i < len; i++)
        {
            if (showStar[i])
            {
                if (serData.star > i)
                {
                    showStar[i].IsGray = UISpriteEx.ColorGray.normal;
                }
                else
                {
                    showStar[i].IsGray = UISpriteEx.ColorGray.Gray;
                }
            }
        }
    }
Exemplo n.º 29
0
    /// <summary>
    /// 收到系统信息
    /// </summary>
    public ChatInfo(pt_system_msg_d689 _pt)
    {
        ChatTemplatesRef Ref = ConfigMng.Instance.GetChatTemplatesRef(_pt.type);

        if (Ref != null)
        {
            isSystemInfo = true;
            chatTypeID   = 5;
            if (Ref.channel.Count > 0)
            {
                switch (Ref.channel[0])
                {
                case 1: chatTypeID = 5; break;

                case 3: chatTypeID = 3; break;

                default: chatTypeID = 5; break;
                }
            }
            else
            {
                Debug.LogError("ChatTemplatesRef 表中的channel字段数据异常  by黄洪兴");
            }
            string        st   = Ref.text;
            int           a    = 0;
            List <string> list = new List <string>();
            for (int i = 0; i < Ref.parameter.Count; i++)
            {
                switch (Ref.parameter[i])
                {
                case 1: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data); funcationList.Add(1);
                    }
                    break;

                case 2: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            EquipmentInfo item = new EquipmentInfo(Convert.ToInt32(_pt.nomal_list[i].data), EquipmentBelongTo.PREVIEW);
                            equipmentRefList.Add(item);
                            list.Add(item.ItemStrColor + item.ItemName + "[-]");
                            funcationList.Add(2);
                        }
                    }
                    break;

                case 3: if (_pt.item.Count > a)
                    {
                        EquipmentInfo item = new EquipmentInfo(_pt.item[a], true); equipmentList.Add(item); list.Add(item.ItemStrColor + item.ItemName + "[-]"); a++; funcationList.Add(3);
                    }
                    break;

                case 4: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            SceneRef SceneRef = ConfigMng.Instance.GetSceneRef(Convert.ToInt32(_pt.nomal_list[i].data));
                            if (SceneRef != null)
                            {
                                list.Add(SceneRef.name);
                            }
                            funcationList.Add(4);
                        }
                    }
                    break;

                case 5: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            MonsterRef monsterRef = ConfigMng.Instance.GetMonsterRef(Convert.ToInt32(_pt.nomal_list[i].data));
                            if (monsterRef != null)
                            {
                                list.Add(monsterRef.name);
                            }
                        }
                    }
                    break;

                case 6: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 7: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 8: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 9: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 10: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            MonsterRef monsterRef = ConfigMng.Instance.GetMonsterRef(Convert.ToInt32(_pt.nomal_list[i].data));
                            if (monsterRef != null)
                            {
                                list.Add(monsterRef.name);
                            }
                        }
                    }
                    break;

                case 13: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 14: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            MountRef mountRef = ConfigMng.Instance.GetMountRef(Convert.ToInt32(_pt.nomal_list[i].data));
                            if (mountRef != null)
                            {
                                list.Add(mountRef.mountName);
                            }
                        }
                    }
                    break;

                case 15: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            RidePropertyRef rideRef = ConfigMng.Instance.GetMountPropertyRef(Convert.ToInt32(_pt.nomal_list[i].data));
                            if (rideRef != null)
                            {
                                list.Add(rideRef.name);
                            }
                        }
                    }
                    break;

                case 16: if (_pt.nomal_list.Count > i)
                    {
                        string s = string.Empty;
                        int    num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            switch (Convert.ToInt32(_pt.nomal_list[i].data))
                            {
                            case 1: s = ConfigMng.Instance.GetUItext(70); break;

                            case 2: s = ConfigMng.Instance.GetUItext(71); break;

                            case 3: s = ConfigMng.Instance.GetUItext(72); break;

                            case 4: s = ConfigMng.Instance.GetUItext(73); break;

                            case 5: s = ConfigMng.Instance.GetUItext(74); break;

                            default:
                                break;
                            }
                            if (s != string.Empty)
                            {
                                list.Add(s);
                            }
                        }
                    }
                    break;

                case 18: if (_pt.nomal_list.Count > i)
                    {
                        if (_pt.nomal_list[i].data != string.Empty)
                        {
                            list.Add(_pt.nomal_list[i].data);
                        }
                        else
                        {
                            list.Add(string.Empty);
                        }
                    }
                    break;

                case 19: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 20: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            list.Add(ConfigMng.Instance.GetLevelDes(Convert.ToInt32(_pt.nomal_list[i].data)));
                        }
                    }
                    break;

                case 23: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            playerID.Add(Convert.ToInt32(_pt.nomal_list[i].data));
                        }
                    }
                    break;

                case 24: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 25: if (_pt.nomal_list.Count > i)
                    {
                        int num;
                        if (int.TryParse(_pt.nomal_list[i].data, out num))
                        {
                            CheckPointRef CKRef = ConfigMng.Instance.GetCheckPointRef(Convert.ToInt32(_pt.nomal_list[i].data));
                            if (CKRef != null)
                            {
                                list.Add(CKRef.name);
                            }
                        }
                    }
                    break;

                case 26: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                case 27: if (_pt.nomal_list.Count > i)
                    {
                        list.Add(_pt.nomal_list[i].data);
                    }
                    break;

                default:
                    break;
                }
            }

            chatContent = UIUtil.Str2Str(st, list);

            if (Ref.channel.Count > 1)
            {
                MerryGoRoundDataInfo Info = new MerryGoRoundDataInfo(chatContent);
                if (GameCenter.chatMng.OnAddMerryGoRoundData != null)
                {
                    GameCenter.chatMng.OnAddMerryGoRoundData(Info);
                }
            }
        }
    }
Exemplo n.º 30
0
    void ShowSettlementFlop()
    {
        SceneRef scene = ConfigMng.Instance.GetSceneRef(GameCenter.mainPlayerMng.MainPlayerInfo.SceneID);

        btnNext.SetActive(scene.sort == SceneType.ENDLESS);
    }