Exemplo n.º 1
0
    void PlotOverSave()
    {
        print("对话 存档是否 被调用 !!!!!!!!!!!!");

        for (int i = 0; i < OverCunRuShuJuArr.Length; i++)
        {
            GlobalDateControl.SetMsgInCurrentGKDateAndSetInZGKDate(OverCunRuShuJuArr[i]);
        }

        //ObjectEventDispatcher.dispatcher.addEventListener(EventTypeName.OPEN_DOOR, OpenDoor);
        ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.OPEN_DOOR, "Men_2-0"), this);
        if (IsNeedRecordByOver)
        {
            GlobalDateControl.SaveMapDate();
        }


        //是否出现啥 徽章  或者爆炸 等


        //if (IsOverMoveSelf)
        //{
        //    OverDelSelf();
        //}

        //能不能延迟 才能使玩家 行动
    }
Exemplo n.º 2
0
    void ChangeScreen()
    {
        print(" 场景 变化   screenChange ");
        playerUI = GlobalTools.FindObjByName("PlayerUI");
        playerUI.GetComponent <PlayerUI>().skill_bar.GetComponent <UI_ShowPanel>().SaveAllHZDate();

        //用来判断 地图地形 是否生成 过 如果生成过 就不用再生成了 直接根据数据生成就可以(控制 地图块内的 自动生成 粒子 草之类的)
        GlobalSetDate.instance.IsCMapHasCreated = false;

        //获取角色当前数据 当前血量 当前蓝量  发给GlobalSetDate  什么格式 以后再说  cLive=1000,cLan=1000
        GlobalSetDate.instance.ScreenChangeDateRecord();
        GlobalSetDate.instance.HowToInGame = GlobalSetDate.CHANGE_SCREEN;
        if (GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1") != null)
        {
            //GlobalSetDate.instance.bagDate = GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1").GetComponent<Mianban1>().HZSaveDate();
            //GlobalSetDate.instance.CurrentMapMsgDate.bagDate = GlobalSetDate.instance.CurrentMapMsgDate.bagDate = GlobalSetDate.instance.bagDate;
            GlobalSetDate.instance.CurrentMapMsgDate.bagDate = GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1").GetComponent <Mianban1>().HZSaveDate();
            print("切换到新 地图时  总地图数据  " + GlobalSetDate.instance.CurrentMapMsgDate.mapDate);
            print("GlobalSetDate.instance.CurrentMapMsgDate.bagDate: " + GlobalSetDate.instance.CurrentMapMsgDate.bagDate);
            GlobalDateControl.SaveMapDate();
        }


        //通知储存关卡变化的数据
        ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.CHANGE_SCREEN, null), this);
        //ObjectPools.GetInstance().delAll();//解决切换场景时候特效没回收被销毁导致再取取不出来的问题  但是这样销毁会导致卡顿很长的切换速度 已用重新创建解决
        SetPlayerPositionAndScreen();
        //SceneManager.LoadScene("loads");
        //print("***  GlobalSetDate.instance.screenName   "+ GlobalSetDate.instance.screenName);
        StartCoroutine(IEStartLoading(GlobalSetDate.instance.screenName));
        playerUI.GetComponent <PlayerUI>().GetScreenZZChange(1);

        //GlobalSetDate.instance.Show_UIZZ();
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (isUp)
        {
            if (men && men.transform.position.y < upPos.transform.position.y)
            {
                float moveY = men.transform.position.y + moveSpeed;
                men.transform.position = new Vector3(men.transform.position.x, moveY, men.transform.position.z);
                Gensui();
            }
            else
            {
                if (!isCanBeRecord)
                {
                    return;
                }
                string zt = this.name + "-0";
                ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RECORDOBJ_CHANGE, zt), this);
                isUp = false;
                if (isSaveBySelf)
                {
                    GlobalDateControl.SaveMapDate();
                }
                if (openDoorAudio)
                {
                    openDoorAudio.Stop();
                }
                _zt = "0";
            }
        }

        if (isDown)
        {
            if (men && men.transform.position.y > downPos.transform.position.y)
            {
                float moveY = men.transform.position.y - moveSpeed;
                men.transform.position = new Vector2(men.transform.position.x, moveY);
                Gensui();
            }
            else
            {
                if (!isCanBeRecord)
                {
                    return;
                }
                string zt = this.name + "-1";
                ObjectEventDispatcher.dispatcher.dispatchEvent(new UEvent(EventTypeName.RECORDOBJ_CHANGE, zt), this);
                isDown = false;
                if (isSaveBySelf)
                {
                    GlobalDateControl.SaveMapDate();
                }
                if (openDoorAudio)
                {
                    openDoorAudio.Stop();
                }
                _zt = "1";
            }
        }
    }
Exemplo n.º 4
0
    //记录数据的改变 存入全局临时变量  如果是BOSS死掉 存入文档 捡到boss装备也要自动存档
    public void GKDateChange(UEvent e)
    {
        print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 关卡数据匹配 当前 关卡名  " + GlobalDateControl.GetCurrentGKDate().Split(':')[0]);
        string changeDate = e.eventParams.ToString();         //Men_1-1
        //print(" GKDateChange 事件  "+ changeDate);
        string changeDateName = changeDate.Split('-')[0];     //men_1
        string type           = changeDateName.Split('_')[0]; //men
        string changezt;

        if (changeDate.Split('-').Length > 1)
        {
            changezt = changeDate.Split('-')[1];
        }

        string TempCurrentGKDate = GlobalDateControl.GetCurrentGKDate().Split(':')[1];

        print("临时 关卡 数据 :   " + TempCurrentGKDate);
        if (TempCurrentGKDate == "")
        {
            TempCurrentGKDate = changeDate;
            print("临时 关卡 数据 没有数据的时候  TempCurrentGKDate>>>> : " + TempCurrentGKDate);
        }
        else
        {
            //print(" >>????? TempCurrentGKDate     "+ TempCurrentGKDate+ "  ??changeDate   "+ changeDate);
            //men_1-0,men_2-0,boss_1-0 当前关卡数据长这样
            string[] currentGKDateArr = TempCurrentGKDate.Split(',');
            //先查找 关卡数据中是否有该数据 有的就变化状态 没有的话就在后面加
            if (!GlobalTools.IsHasDate(changeDate, currentGKDateArr))
            {
                TempCurrentGKDate += "," + changeDate;
                print(" 如果 原始数据 没有新数据 直接 加载后面? 生成数据是:    " + TempCurrentGKDate + "  /////// 新数据:   " + changeDate);
                //return;
            }
            else
            {
                print("如果 变化数据 原始数据中有的 话 进入这里 开始 更新 数据状态 @@@@@@");
                string newGKDate = "";
                for (var i = 0; i < currentGKDateArr.Length; i++)
                {
                    string theGKDate = currentGKDateArr[i];
                    string dateName  = theGKDate.Split('-')[0];
                    //if (Globals.isDebug) print("theGKDate  >  " + theGKDate);
                    //string zt = theGKDate.Split('-')[1];
                    //这里 替换了 名字相同的内容  也就是替换了状态
                    if (dateName == changeDateName)
                    {
                        if (i != currentGKDateArr.Length - 1)
                        {
                            newGKDate += changeDate + ",";
                        }
                        else
                        {
                            newGKDate += changeDate;
                        }
                    }
                    else
                    {
                        if (i != currentGKDateArr.Length - 1)
                        {
                            newGKDate += theGKDate + ",";
                        }
                        else
                        {
                            newGKDate += theGKDate;
                        }
                    }
                }
                TempCurrentGKDate = newGKDate;
                print("  改变状态后的 数据 TempCurrentGKDate   " + TempCurrentGKDate);
            }
        }



        //string TempGKDateStr = GuankaName + ":" + TempCurrentGKDate;
        string TempGKDateStr = GlobalDateControl.GetCGKName() + ":" + TempCurrentGKDate;

        if (TempCurrentGKDate != null)
        {
            GlobalDateControl.SetCurrentGKDateInZGKTempDate(TempGKDateStr);
        }
        print("记录数据   TempCurrentGKDate        " + TempGKDateStr);
        //print("TempCurrentGKDate:    " + TempCurrentGKDate);
        if (type == "boss" || type == "G" || type == "B" || type == "WP")
        {
            //将关卡数据写入全局临时数据 存档
            GlobalDateControl.SaveMapDate();
        }
    }
Exemplo n.º 5
0
    //启动游戏的时候 调用存档数据先  对比当前关卡数据是否有变动
    //每关都要对比加到临时数据



    //GameObject UI_screenChangeZZ;

    //public void Show_UIZZ()
    //{
    //    if (!UI_screenChangeZZ)
    //    {
    //        UI_screenChangeZZ = GlobalTools.GetGameObjectByName("ZZ_screenChange");
    //    }
    //    UI_screenChangeZZ.GetComponent<UI_screenChangeZZ>().Show_UIZZ();
    //}

    //public void Hide_UIZZ()
    //{
    //    if (!UI_screenChangeZZ)
    //    {
    //        UI_screenChangeZZ = GlobalTools.GetGameObjectByName("ZZ_screenChange");
    //    }
    //    UI_screenChangeZZ.GetComponent<UI_screenChangeZZ>().Hide_UIZZ();
    //}

    //public void ShowLoadProgressNums(float nums, bool isHasChangeScreen = false)
    //{
    //    UI_screenChangeZZ.GetComponent<UI_screenChangeZZ>().ShowLoadProgressNums(nums);
    //}



    public void GetSave()
    {
        //储存玩家所有数据
        print("SAVE.........");
        //if (Globals.isDebug) print("save临时总关卡数据  " + TempZGuanKaStr);
        GameObject player = GlobalTools.FindObjByName("player");

        if (player == null)
        {
            return;
        }
        if (CurrentUserDate == null)
        {
            CurrentUserDate = new UserDate();
        }
        CurrentUserDate.curLive = player.GetComponent <RoleDate>().live.ToString();
        print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@CurrentUserDate.curLive存档时血量    " + CurrentUserDate.curLive);
        CurrentUserDate.curLan = player.GetComponent <RoleDate>().lan.ToString();
        //CurrentUserDate.screenName = SceneManager.GetActiveScene().name;
        CurrentUserDate.screenName = GlobalDateControl.GetCGKName();
        if (HowToInGame == TEMP_SCREEN)
        {
            //print("临时进的游戏吗????");
            CurrentUserDate.playerPosition = player.transform.position.x + "_" + player.transform.position.y;
        }
        else
        {
            CurrentUserDate.playerPosition = player.transform.position.x + 2 + "_" + player.transform.position.y;
        }
        //print("储存的 玩家位置    "+ CurrentUserDate.playerPosition);
        //存档时候 技能CD满
        GlobalTools.FindObjByName("PlayerUI").GetComponent <PlayerUI>().skill_bar.GetComponent <UI_ShowPanel>().AllSkillCDFull();

        CurrentUserDate.cameraPosition = GlobalTools.FindObjByName("MainCamera").transform.position.x + "_" + GlobalTools.FindObjByName("MainCamera").transform.position.y;
        //CurrentUserDate.mapDate = GlobalTools.FindObjByName("MainCamera").GetComponent<GameControl>().GetSaveZGKDate();
        GlobalDateControl.SaveMapDate();
        //print(" @@@@---  CurrentUserDate.mapDate     "+ CurrentUserDate.mapDate);
        if (GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1") != null)
        {
            CurrentUserDate.bagDate = CurrentMapMsgDate.bagDate;                                                               //GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1").GetComponent<Mianban1>().HZSaveDate();
        }
        //print(" 储存进来的徽章数据   "+ CurrentUserDate.bagDate);
        //血瓶数量
        if (GlobalTools.FindObjByName("PlayerUI(Clone)/xueping") != null)
        {
            CurrentUserDate.xp_nums = GlobalTools.FindObjByName("PlayerUI(Clone)/xueping").GetComponent <XuePingBox>().GetXPNums();
        }
        CurrentUserDate.userName = "******";
        CurrentUserDate.onlyId   = 2;
        ScreenChangeDateRecord();

        //print(CurrentUserDate.curLan);
        //print(CurrentUserDate.screenName);
        //print(CurrentUserDate.playerPosition);
        //print(CurrentUserDate.cameraPosition);
        //print("mapdate---------------------------------------------------------------->   "+CurrentUserDate.mapDate);
        //print(CurrentUserDate.userName);



        GameSaveDate.GetInstance().SaveDateByURLName(saveDateName, CurrentUserDate);

        //print("////////////////////////////////////////////////////////////////////////////////////////////////////////===================================记录完成!!! ");
    }