Esempio n. 1
0
    public void SaveSceneData()
    {
        SceneInfoBean sceneInfo = new SceneInfoBean();

        sceneInfo.id    = sceneId;
        sceneInfo.valid = 1;

        SceneDetailsBean sceneDetails = new SceneDetailsBean();

        for (int i = 0; i < BuildingHandler.Instance.transform.childCount; i++)
        {
            Transform    tfItem       = BuildingHandler.Instance.transform.GetChild(i);
            BuildingBase baseBuilding = tfItem.GetComponent <BuildingBase>();
            if (baseBuilding == null)
            {
                continue;
            }
            SceneDetailsItemBean sceneDetailsItem = new SceneDetailsItemBean();
            sceneDetailsItem.buildingId = baseBuilding.buildingInfo.id;
            sceneDetailsItem.position   = new Vector3Bean(tfItem.position);
            sceneDetailsItem.size       = new Vector3Bean(tfItem.localScale);
            sceneDetailsItem.angle      = new Vector3Bean(tfItem.eulerAngles);
            sceneDetails.listBuildingData.Add(sceneDetailsItem);
        }

        sceneInfo.SetSceneDetilas(sceneDetails);

        sceneInfoService.UpdateData(sceneInfo);
    }
Esempio n. 2
0
    /// <summary>
    /// 获取游戏数据
    /// </summary>
    /// <returns></returns>
    public SceneInfoBean GetSceneInfoData()
    {
        SceneInfoBean data = serviceSceneInfo.QueryData();

        if (data == null)
        {
            data = new SceneInfoBean();
        }
        return(data);
    }
Esempio n. 3
0
    /// <summary>
    /// 更新数据
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    public bool UpdateData(SceneInfoBean data)
    {
        bool deleteState = BaseDeleteDataById(data.id);

        if (deleteState)
        {
            bool insertSuccess = BaseInsertData(tableNameForMain, data);
            return(insertSuccess);
        }
        return(false);
    }
Esempio n. 4
0
    /// <summary>
    /// 获取数据
    /// </summary>
    /// <param name="action"></param>
    /// <returns></returns>
    public SceneInfoBean GetSceneInfoData(Action <SceneInfoBean> action)
    {
        SceneInfoBean data = GetModel().GetSceneInfoData();

        if (data == null)
        {
            GetView().GetSceneInfoFail("没有数据", null);
            return(null);
        }
        GetView().GetSceneInfoSuccess <SceneInfoBean>(data, action);
        return(data);
    }
Esempio n. 5
0
 /// <summary>
 /// 保存游戏数据
 /// </summary>
 /// <param name="data"></param>
 public void SetSceneInfoData(SceneInfoBean data)
 {
     serviceSceneInfo.UpdateData(data);
 }