示例#1
0
 void GetSetSaveGameByBtnName(string btnName)
 {
     if (isGetDate)
     {
         //取
         if (GameSaveDate.GetInstance().GetSaveDateByName(btnName) != null)
         {
             GlobalSetDate.instance.CurrentUserDate = GameSaveDate.GetInstance().GetSaveDateByName(btnName);
             UserDate t = GlobalSetDate.instance.CurrentUserDate;
             GlobalSetDate.instance.isInFromSave = true;
             //调用进入游戏
             GlobalSetDate.instance.GetGameDateStart();
         }
     }
     else
     {
         //存
         if (GlobalSetDate.instance.CurrentUserDate != null)
         {
             GameSaveDate.GetInstance().SaveDateByURLName(btnName, GlobalSetDate.instance.CurrentUserDate);
         }
         else
         {
             //给弹框
         }
     }
     RemoveSelf();
 }
示例#2
0
    void GetButton()
    {
        //btn3.interactable = false;
        Button[] b = { btn1, btn2, btn3, btn4, btn5, btnX };
        btns.AddRange(b);

        //获取存档 如果有存档 显示继续游戏  新游戏放到最下
        //print("查找是否有存档"+GameSaveDate.GetInstance().IsHasSaveDate());
        if (GameSaveDate.GetInstance().IsHasSaveDate())
        {
            Vector2 p = btn2.transform.position;
            btn2.transform.position = btn1.transform.position;
            //btn1.gameObject.SetActive(false);
            btn1.transform.position  = p;
            kuang.transform.position = btn2.transform.position;
        }
        else
        {
            btn2.gameObject.SetActive(false);
        }

        //如果没有存档  显示新游戏  继续游戏按钮隐藏
        //如果有存档 点新游戏给提示

        btn1.onClick.AddListener(GameStart);
        btn2.onClick.AddListener(GetSaveDateUI);
        btn3.onClick.AddListener(GetSetUI);
        btn4.onClick.AddListener(OutGame);
        btn5.onClick.AddListener(InSYS);
        btnX.onClick.AddListener(ClearSave);
        GetLuanguage();
        ObjectEventDispatcher.dispatcher.addEventListener(EventTypeName.GAME_LANGUAGE, GetLanguageChange);
    }
示例#3
0
 public static void GetBigMapDateInSavedate()
 {
     if (_mapSaveDate == null)
     {
         _mapSaveDate = GameSaveDate.GetInstance().GetMapSaveDateByName();
     }
 }
示例#4
0
    //public GameObject player;

    void InNewGame(string pos = "-120.47_-3.14", string scrName = "ng1_o-1")
    {
        if (CurrentUserDate == null)
        {
            CurrentUserDate = new UserDate();
        }
        if (CurrentMapMsgDate == null)
        {
            CurrentMapMsgDate = new UserDate();
        }
        playerPosition                 = pos;
        screenName                     = scrName;
        cameraPosition                 = "";
        bagDate                        = ""; //背包数据
        mapDate                        = ""; //小地图数据
        xp_nums                        = 0;  //血瓶数量
        CurrentUserDate.screenName     = SceneManager.GetActiveScene().name;
        CurrentUserDate.playerPosition = playerPosition;
        CurrentUserDate.cameraPosition = playerPosition;
        CurrentUserDate.mapDate        = mapDate;
        CurrentUserDate.bagDate        = bagDate;
        //血瓶数量
        CurrentUserDate.xp_nums  = xp_nums;
        CurrentUserDate.userName = "******";
        CurrentUserDate.onlyId   = 2;
        GameSaveDate.GetInstance().SaveDateByURLName(saveDateName, CurrentUserDate);
        GameSaveDate.GetInstance().SaveDateByURLName(saveDateName + "Map", CurrentUserDate);
        IsChangeScreening = false;
        //print("hi!!!!");


        //清除 选择的 other数据
        OtherDate = new OtherSaveDate();
        GameSaveDate.GetInstance().SaveOtherDateByURLName(OtherDate);
    }
示例#5
0
 //isSYS 是游戏实验室
 public void GetGameDateStart(bool isSYS = false)
 {
     //获取角色的信息 位置 摄像机位置 背包数据 小地图数据 收集物数据 角色状态
     if (isInFromSave)
     {
         print("读档游戏");
         HowToInGame     = LOAD_GAME;
         CurrentUserDate = GameSaveDate.GetInstance().GetSaveDateByName(saveDateName);
         GetSaveGame();
     }
     else
     {
         print("新游戏");
         HowToInGame = NEW_GAME;
         if (isSYS)
         {
             //实验室
             InNewGame("0.59_-0.54", "shiyanshi_1");
         }
         else
         {
             InNewGame();
         }
     }
     isGameOver = false;
     SceneManager.LoadScene("loads");
 }
示例#6
0
 static public GameSaveDate GetInstance()
 {
     if (instance == null)
     {
         instance = new GameSaveDate();
     }
     return(instance);
 }
示例#7
0
 void ShowSaveDateMsg()
 {
     date1 = GameSaveDate.GetInstance().GetSaveDateByName(btn1.name);
     date2 = GameSaveDate.GetInstance().GetSaveDateByName(btn2.name);
     date3 = GameSaveDate.GetInstance().GetSaveDateByName(btn3.name);
     ShowBtnMsg(btn1, date1);
     ShowBtnMsg(btn2, date2);
     ShowBtnMsg(btn3, date3);
 }
示例#8
0
 //***********************************************other数据获取区*************************************************************
 public OtherSaveDate GetOtherDate()
 {
     if (OtherDate == null)
     {
         OtherDate = new OtherSaveDate();
     }
     OtherDate = GameSaveDate.GetInstance().GetOtherSaveDateByName();
     //print("  获取了 otherdate!!   "+OtherDate.GlobalOtherDate);
     return(OtherDate);
 }
示例#9
0
 public static void ClearMapSaveDate()
 {
     _mapSaveDate = GameSaveDate.GetInstance().GetMapSaveDateByName();
     if (_mapSaveDate == null)
     {
         _mapSaveDate = new MapSaveDate();
     }
     _mapSaveDate.BigMapDate = "";
     _mapSaveDate.MapDate    = "";
     SaveMapDateInMapDate();
 }
示例#10
0
 //查看是否有存档来显示 继续游戏按钮
 void FindSaveDate()
 {
     if (GameSaveDate.GetInstance().IsHasSaveDate())
     {
         btn2.interactable        = true;
         kuang.transform.position = btn2.transform.position;
         getRQ = btn2;
     }
     else
     {
         btn2.interactable        = false;
         kuang.transform.position = btn1.transform.position;
         getRQ = btn1;
     }
 }
示例#11
0
 //查看是否有存档来显示 继续游戏按钮
 void FindSaveDate()
 {
     if (GameSaveDate.GetInstance().IsHasSaveDate())
     {
         print("有存档!!!!!!");
         btn2.interactable        = true;
         kuang.transform.position = btn2.transform.position;
         getRQ = btn2;
     }
     else
     {
         btn2.interactable        = false;
         kuang.transform.position = btn1.transform.position;
         getRQ = btn1;
         //btn2.gameObject.SetActive(false);
     }
 }
示例#12
0
    public static void SaveMapDate()
    {
        //print("SaveMapDate! ");
        if (GlobalSetDate.instance.CurrentMapMsgDate == null)
        {
            GlobalSetDate.instance.CurrentMapMsgDate = new UserDate();
        }
        GlobalSetDate.instance.CurrentMapMsgDate.mapDate = GetZGKDate();
        if (GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1") != null)
        {
            GlobalSetDate.instance.CurrentMapMsgDate.bagDate = GlobalTools.FindObjByName("UI_Bag(Clone)/mianban1").GetComponent <Mianban1>().HZSaveDate();
            //print("存入背包的数据 :   " + GlobalSetDate.instance.CurrentMapMsgDate.bagDate);
        }

        //print(" SaveMapDate :     "+ GlobalSetDate.instance.CurrentMapMsgDate.mapDate);

        GameSaveDate.GetInstance().SaveDateByURLName(GlobalSetDate.instance.saveDateName + "Map", GlobalSetDate.instance.CurrentMapMsgDate);
    }
示例#13
0
    void GetMapDate()
    {
        saveMapName = this.theMapMsg.Split('!')[0];
        UserDate mapDate = GameSaveDate.GetInstance().GetSaveDateByName(saveMapName);

        if (mapDate == null)
        {
            //说明没有存档 要新生成地图
            //GenerateNewMap();

            //GetTest("jing_cao_2");

            //由几大块组成
            int FormNums = 3 + GlobalTools.GetRandomNum(10);
            //大体的 地面路形  比如 混合的 主地板的  主洞内的  跳跃类的 等
            //各种类型 要分list 在类型中去取 组成类型

            /**
             * 1.平地森林
             * 2.曲地森林
             * 3.跳跃洞外森林
             * 4.跳跃洞内
             * 5.跳跃 有移动快的
             * 6.洞内跳跃有移动块的
             * 7.洞内的 上下有拦住 中间可以过的地形
             * 8.洞内弯道
             * 9.上下路线 连接口设计
             */


            //大块类型 洞外  洞内   机关类
            //只是左右的 最少3块  门+直地/洞内 +门
            //上下最少的也是3快  门 +直下洞内/斜着向下 +门



            Qidian();
            CreateScreen();
        }
        else
        {
            //根据mapDate 创建地图
        }
    }
示例#14
0
    //哪几种 情况要存档  1.捡到徽章 2.战胜boss  3.门怪打死后  4.存档点    最简单的办法啊就是价格存档点



    //static string saveDateName = "myGame";
    //static string TempZGuanKaStr = "";


    //匹配存档中的全局关卡记录
    public static void GetGameAllCunstomStr()
    {
        //获取当前关卡的数据

        //是否有存档
        if (GameSaveDate.GetInstance().IsHasMapSaveDate())
        {
            //if (Globals.isDebug) print("!!!!!!!!!!!!!!!!!!有地图数据存档记录");
            //找到总的关卡记录
            GlobalSetDate.instance.CurrentUserDate = GameSaveDate.GetInstance().GetSaveDateByName(GlobalSetDate.instance.saveDateName);
            //print("  背包数据:  "+ GlobalSetDate.instance.CurrentUserDate.bagDate);

            if (GameSaveDate.GetInstance().IsHasSaveDateByName(GlobalSetDate.instance.saveDateName + "Map"))
            {
                //print(GameSaveDate.GetInstance().GetSaveDateByName(CurrentSaveDateName));
                GlobalSetDate.instance.CurrentMapMsgDate = GameSaveDate.GetInstance().GetSaveDateByName(GlobalSetDate.instance.saveDateName + "Map");
                GlobalSetDate.instance.TempZGuanKaStr    = GlobalSetDate.instance.CurrentMapMsgDate.mapDate;
                print("TempZGuanKaStr  " + GlobalSetDate.instance.TempZGuanKaStr);
                //print(" map数据中bag数据 "+ GlobalSetDate.instance.CurrentMapMsgDate.bagDate);
                //print("  当前场景背包数据:  "+ GlobalSetDate.instance.bagDate);
                //if(GlobalSetDate.instance.TempZGuanKaStr!="") GlobalSetDate.instance.HowToInGame = "LoadGame";
            }
            else
            {
                //print("没有当前存档的记录");
            }
        }
        else
        {
            if (Globals.isDebug)
            {
                print("没有地图数据存档记录");
            }
            //记录当前关卡的记录  这里一般是新开游戏
            //TempZGuanKaStr = "";
        }
        //获取存档的关卡记录
    }
示例#15
0
    /// <summary>
    /// 存入 或者改变 other 数据
    /// </summary>
    /// <param name="str"></param>
    public void SaveInOtherDate(string str)
    {
        string key   = str.Split('*')[0];
        string value = str.Split('*')[1];


        print("数据 传入数据是什么吗 str " + str + "  ---键值Key  " + key);
        if (key == "")
        {
            print("键值为空 !!!!");
            return;
        }


        if (GetOtherDateValueByKey(key) != "")
        {
            string        _dateStr      = "";
            string[]      otherDateArr  = OtherDate.GlobalOtherDate.Split('|');
            List <string> otherDateList = new List <string>(otherDateArr);

            for (int i = 0; i < otherDateList.Count; i++)
            {
                string strs = otherDateList[i];
                if (strs.Split('*')[0] == key)
                {
                    strs = key + "*" + value;
                }
                _dateStr += "|" + strs;
            }
            OtherDate.GlobalOtherDate = _dateStr;
        }
        else
        {
            OtherDate.GlobalOtherDate += "|" + str;
        }
        print("数据 ot  其他数据内容OtherDate   " + OtherDate.GlobalOtherDate);
        GameSaveDate.GetInstance().SaveOtherDateByURLName(OtherDate);
    }
示例#16
0
 public static void SaveMapDateInMapDate()
 {
     //_mapSaveDate.MapDate = MapDate;
     GameSaveDate.GetInstance().SaveMapDateByURLName(_mapSaveDate);
 }
示例#17
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("////////////////////////////////////////////////////////////////////////////////////////////////////////===================================记录完成!!! ");
    }