예제 #1
0
 /// <summary>
 /// 执行Sql语句
 /// </summary>
 /// <param name="sqlString">sql语句</param>
 /// <returns></returns>
 public DataSet QuerySet(string sqlString)
 {
     OpenDatabase();
     if (SqlConnection.State == ConnectionState.Open)
     {
         DataSet ds = new DataSet();
         try
         {
             MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(sqlString, SqlConnection);
             mySqlDataAdapter.Fill(ds);
         }
         catch (Exception e)
         {
             // throw new Exception("SQL:" + sqlString + "/n" + e.Message.ToString());
             string strMessage = "SQL:" + sqlString + "/n" + e.Message.ToString();
             Debug_Log.Call_WriteLog(strMessage);
             Debug_Log.Call_WriteLog(sqlString, "sqlString", "Unity");
             Debug_Log.Call_WriteLog(e, "QuerySet", "Unity");
         }
         finally
         {
             CloseDataBase();
         }
         //Debug_Log.Call_WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(ds), "执行Sql语句ds  ", "Unity");
         return(ds);
     }
     return(null);
 }
예제 #2
0
 /// <summary>
 /// 释放
 /// </summary>
 public void CloseDataBase()
 {
     if (SqlConnection != null)
     {
         SqlConnection.Close();
         SqlConnection.Dispose();
         SqlConnection = null;
     }
     Debug_Log.Call_WriteLog("关闭数据库");
 }
 void Awake()
 {
     if (Application.platform != RuntimePlatform.Android)
     {
         return;
     }
     androidJavaClass  = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
     androidJavaObject = androidJavaClass.GetStatic <AndroidJavaObject>("currentActivity");
     //	androidJavaObject = androidJavaObject.Get<AndroidJavaObject>("functionUnity");
     Debug_Log.Call_WriteLog("com.unity3d.player.UnityPlayer", "com.unity3d.player.UnityPlayer", "unity");
 }
예제 #4
0
 /// <summary>
 /// 执行sql语句并返回是否执行完成
 /// </summary>
 /// <param name="sql"></param>
 /// <returns></returns>
 public bool ExecuteSqlCmd(string sql)
 {
     Debug_Log.Call_WriteLog(sql);
     OpenDatabase();
     if (SqlConnection.State == ConnectionState.Open)
     {
         MySqlCommand cmd = new MySqlCommand(sql, SqlConnection);
         return(cmd.ExecuteNonQuery() > 0);
     }
     CloseDataBase();
     return(false);
 }
예제 #5
0
    public void setBoy(bool selected)
    {
        boolboy = selected;

        Debug_Log.Call_WriteLog("boolboy=" + boolboy, selected.toString(), "Unity");
        Debug.Log(selected);
        if (selected)
        {
        }
        else
        {
        }
    }
예제 #6
0
    void testDB()
    {
        try
        {
            SQLiteHelper_Example.Start();
        }

        catch (Exception ex)
        {
            Debug_Log.Call_WriteLog(ex, "ExecuteQuery", "Unity");
            // Debug_Log.Call_WriteLog(ex, "testDB");
        }
    }
예제 #7
0
    void OnDestroy()
    {
        // Restore road networks that are in Build Mode
        // This is very important otherwise the shape of roads will still be visible inside the terrain!

        if (roadNetwork != null)
        {
            if (roadNetwork.isInBuildMode)
            {
                roadNetwork.RestoreRoadNetwork();
                Debug_Log.Call_WriteLog("Restore Road Network");
            }
        }
    }
    public void setTrainDifficulty(int selected)
    {
        TrainDifficulty = selected;
        Assets.Script.MyIni ini = new Assets.Script.MyIni();
        ini.WriteIniContent("GameContent", "Speed", TrainDifficulty.toString());

        Debug_Log.Call_WriteLog("TrainDifficulty=" + TrainDifficulty, selected.toString(), "Unity");
        Debug.Log(selected);
        //if (selected)
        //{

        //}
        //else {
        //}
    }
예제 #9
0
    public void ReadSD()
    {
        try
        {
            AndroidJavaClass jc = new AndroidJavaClass("com.pico.Integration.ThirdActivity");
            // AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");

            string s01 = jc.CallStatic <string>("ReadSD", getStoragePath() + "/hgignore_global.txt");
            Debug_Log.Call_WriteLog(s01, getStoragePath() + "/hgignore_global.txt", "001PinYIn");
        }
        catch (System.Exception e)
        {
            Debug_Log.Call_WriteLog(e, "ReadSD报错", "001PinYIn");
        }
    }
예제 #10
0
    // Use this for initialization
    public void clickStart()
    {
        try
        {
            //androidJavaObject = new AndroidJavaObject("com.shiyi.u001pinyingame.mediaplayerplugin.TestInstance");
            // String strReturn113331111 = (androidJavaObject.Call<string>("testString"));


            //  androidJavaObject = new AndroidJavaObject("com.shiyi.u001pinyingame.mediaplayerplugin.UnityPlayerActivity");
            //androidJavaObject = new AndroidJavaObject("com.shiyi.u001pinyingame.mediaplayerplugin.UnityPlayerActivity");
            //  androidJavaObject.Call("sendMessageToUnity");



            //androidJavaObject = new AndroidJavaObject("com.shiyi.u001pinyingame.mediaplayerplugin.UnityPlayerActivity");//这个是androidStudio创建的包名加上自己创建的脚本
            //String strReturn111 = androidJavaObject.Call<String>("PreservationSPhoto", "dddddafsdfas");

            AndroidJavaClass  androidJavaClassUnityPlayerActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject androidJavaObjectcurrentActivity    = androidJavaClassUnityPlayerActivity.GetStatic <AndroidJavaObject>("currentActivity");
            // String strReturn = androidJavaObject.Call<String>("PreservationSPhototest", "dddddd");
            /**/
            string strFilename = CaptureCamera(mainCamera, uiCamera, new Rect(0, 0, Screen.width, Screen.height));

            Debug.Log(Application.persistentDataPath);

            if (File.Exists(strFilename))
            {
                androidJavaObject = new AndroidJavaObject("com.shiyi.u001pinyingame.mediaplayerplugin.UnityPlayerActivity");//这个是androidStudio创建的包名加上自己创建的脚本
                androidJavaObject.Call("PreservationSPhoto", strFilename, androidJavaObjectcurrentActivity);


                //string strWindowsHeadPath = Path.Combine((new AndoridSD()).getStoragePath(), "DCIM/fff.jpg");
                //File.Copy(strFilename, strWindowsHeadPath);

                /// androidJavaObject = new AndroidJavaObject("com.unity3d.player.UnityPlayerActivity");//这个是androidStudio创建的包名加上自己创建的脚本
                // Debug_Log.Call_WriteLog("dddd", "dasdf", "untiy");
                // androidJavaObject.Call<string>("PreservationSvideotape", strFilename);

                // string ddPreservationSPhotoTestd = PreservationSPhotoTest(strFilename);
                // Debug_Log.Call_WriteLog(ddPreservationSPhotoTestd, "ddPreservationSPhotoTestd", "untiy");
                // PreservationSPhoto(strFilename);
            }
        }
        catch (Exception EEEE)
        {
            Debug_Log.Call_WriteLog(EEEE, "clickStart", "untiy");
        }
    }
예제 #11
0
    /// <summary>
    /// 创建表
    /// </summary>
    /// <param name="name">表名</param>
    /// <param name="colName">属性列</param>
    /// <param name="colType">属性类型</param>
    /// <returns></returns>
    public DataSet CreateTable(string name, string[] colName, string[] colType)
    {
        if (colName.Length != colType.Length)
        {
            Debug_Log.Call_WriteLog("输入不正确:" + "columns.Length != colType.Length");
        }

        string query = "CREATE TABLE  " + name + "(" + colName[0] + " " + colType[0];

        for (int i = 1; i < colName.Length; i++)
        {
            query += "," + colName[i] + " " + colType[i];
        }
        query += ")";
        return(QuerySet(query));
    }
예제 #12
0
    public string getStoragePath()
    {
        string s2getStoragePath = "";

        try
        {
            AndroidJavaClass jc = new AndroidJavaClass("com.pico.Integration.ThirdActivity");
            s2getStoragePath = jc.CallStatic <string>("getStoragePath", true);
            Debug_Log.Call_WriteLog(s2getStoragePath, "s2getStoragePath", "001PinYIn");
        }
        catch (System.Exception e)
        {
            s2getStoragePath = Debug_Log.Call_WriteLog(e, "Test333", "001PinYIn");
        }
        return(s2getStoragePath);
    }
예제 #13
0
    //public static ArrayList ContentList = new ArrayList() ;

    public void setContent(string selected)
    {
        Toggle Content_Ele = GameObject.Find("Content_" + selected).transform.GetComponentsInChildren <Toggle>()[0];

        Debug_Log.Call_WriteLog(Content_Ele.isOn, "点击" + selected.toString(), "Unity");

        ArrayList ContentList = new ArrayList();

        Assets.Script.ReadIniPar ReadIniPargetParme = Assets.Script.getPar.getParme();
        ArrayList bContent = new ArrayList(ReadIniPargetParme.Content.Split(','));

        if (!System.String.IsNullOrEmpty(ReadIniPargetParme.Content))///如果读取到值了就赋值
        {
            ContentList = bContent;
        }

        // TrainTime = selected;
        if (ContentList.Contains(selected) && !Content_Ele.isOn)
        {
            ContentList.Remove(selected);
        }
        else if (!ContentList.Contains(selected) && Content_Ele.isOn)
        {
            ContentList.Add(selected);
        }
        string str = string.Join(",", (string[])ContentList.ToArray(typeof(string)));

        Assets.Script.MyIni ini = new Assets.Script.MyIni();
        ini.WriteIniContent("GameContent", "Content", str);


        //转换成数组

        //string strdddd = string.Join(",", (string[])ContentList.ToArray(typeof(string)));
        Debug_Log.Call_WriteLog("setContent=" + str, selected.toString(), "Unity");
        Debug.Log(selected);



        //if (selected)
        //{

        //}
        //else {
        //}
    }
예제 #14
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="connectionString">数据库连接字符串</param>
 public SQLiteHelper(string connectionString)
 {
     try
     {
         lock (lockThis)
         {
             //构造数据库连接
             dbConnection = new SqliteConnection(connectionString);
             //打开数据库
             dbConnection.Open();
         }
     }
     catch (Exception e)
     {
         Debug_Log.Call_WriteLog(e, "SQLiteHelper", "Unity");
         Debug.Log(e.Message);
     }
 }
예제 #15
0
    public void setTrainTime(int selected)
    {
        TrainTime = selected;
        Assets.Script.MyIni ini = new Assets.Script.MyIni();
        ini.WriteIniContent("GameContent", "LengthofTime", TrainTime.toString());

        Debug_Log.Call_WriteLog("TrainTime=" + TrainTime, selected.toString(), "Unity");
        Debug.Log(selected);



        //if (selected)
        //{

        //}
        //else {
        //}
    }
예제 #16
0
    // Use this for initialization


    public void WriteSD()
    {
        try
        {
            ReadSD();
            AndroidJavaClass jc = new AndroidJavaClass("com.pico.Integration.ThirdActivity");
            //AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");

            //            string s1 = jc.CallStatic<string>("WriteSD", "/storage/0000-E33A/Download/mysdcard2.txt");
            string s1 = jc.CallStatic <string>("WriteSD", getStoragePath() + "/mysdcard2.txt");
            Debug_Log.Call_WriteLog(getStoragePath(), "getStoragePath()", "001PinYIn");
            Debug_Log.Call_WriteLog(getStoragePath() + "/mysdcard2.txt", "getStoragePath()mysdcard2", "001PinYIn");
            Debug_Log.Call_WriteLog(s1, "s1", "001PinYIn");
        }
        catch (System.Exception e)
        {
            Debug_Log.Call_WriteLog(e, "s1", "001PinYIn");
        }
    }
예제 #17
0
    /// <summary>
    /// 通过SQL语句查询是否数据库存在某表
    /// </summary>
    /// <param name="sql"></param>
    /// <returns></returns>
    public bool ExitTable(string sql)
    {
        OpenDatabase();
        MySqlCommand    cmd    = new MySqlCommand(sql, SqlConnection);
        MySqlDataReader reader = cmd.ExecuteReader();

        if (reader.HasRows == false)
        {
            Debug_Log.Call_WriteLog("该表不存在");
            CloseDataBase();
            return(false);
        }
        else
        {
            Debug_Log.Call_WriteLog("表存在");
            CloseDataBase();
            return(true);
        }
    }
예제 #18
0
    /// <summary>
    /// 打开数据库
    /// </summary>
    public void OpenDatabase()
    {
        string SqlString = string.Format("Database={0};Data Source={1};User Id={2};Password={3};charset=gbk", dataBase, host, userid, pwd, "3306");

        try
        {
            SqlConnection = new MySqlConnection(SqlString);
            SqlConnection.Open();


            Debug_Log.Call_WriteLog("打开数据库");
        }
        catch (Exception e)
        {
            Debug_Log.Call_WriteLog(e, "服务器连接失败,请重新检查是否打开MySql服务");
            Debug_Log.Call_WriteLog(SqlString, "服务器连接失败,请重新检查是否打开MySql服务");
            //InputIP.ReadIP();
        }
    }
예제 #19
0
 /// <summary>
 /// 执行SQL命令
 /// </summary>
 /// <returns>The query.</returns>
 /// <param name="queryString">SQL命令字符串</param>
 public SqliteDataReader ExecuteQuery(string queryString)
 {
     try
     {
         lock (lockThis)
         {
             dbCommand             = dbConnection.CreateCommand();
             dbCommand.CommandText = queryString;
             dataReader            = dbCommand.ExecuteReader();
         }
     }
     catch (Exception e)
     {
         Debug_Log.Call_WriteLog(queryString, "ExecuteQueryqueryString", "Unity");
         Debug_Log.Call_WriteLog(e, "ExecuteQuery", "Unity");
         Debug.Log(e.Message);
     }
     return(dataReader);
 }
예제 #20
0
        public static string writeDBRecord()
        {
            string strInputFieldName = "";

            try
            {
                ReadIniPar ReadIniPargetParme = getPar.getParme();
                //ContentList = new ArrayList(strContent.Split(','));


                List <String> listDBFieldName = new List <string>();
                listDBFieldName.Add("UserID");
                listDBFieldName.Add("BeginTime");

                listDBFieldName.Add("Duration");
                listDBFieldName.Add("difficulty");
                listDBFieldName.Add("CreateTime");



                List <String> listValues = new List <string>();
                listValues.Add(StaticGlobal.UserID.toString());
                listValues.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
                listValues.Add(ReadIniPargetParme.LengthofTime.toString());
                listValues.Add(ReadIniPargetParme.speed.toString());
                listValues.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));


                MySQLManager dddMySQLManager = new MySQLManager();
                dddMySQLManager.InsertInto("train", listDBFieldName.ToArray(), listValues.ToArray());
                System.Data.DataTable ddddtrain = dddMySQLManager.QuerySet("SELECT max(ID) from train where UserID=" + StaticGlobal.UserID.toString()).Tables[0];
                StaticGlobal.TrainID = ddddtrain.Rows[0][0].toInt32();
                Debug_Log.Call_WriteLog(StaticGlobal.TrainID.toString(), "执行Sql语句dsStaticGlobal  ", "Unity");
            }
            catch (Exception ex)
            {
                ////LogController.writeErrorLog(ex, "ObjectExtended toInt32");
                Debug_Log.Call_WriteLog(ex, "readAllDB");
            }
            return(strInputFieldName);
            //System.Data.DataSet myDataSet =
        }
예제 #21
0
    /// <summary>
    /// 获取表中指定条件下,某字段的行数
    /// </summary>
    /// <param name="column_name"></param>
    /// <param name="table_name"></param>
    /// <param name="condition"></param>
    /// <param name="value"></param>
    /// <returns></returns>
    public int GetDataLineCount(string column_name, string table_name, string condition, string value)
    {
        int _Num = 0;

        OpenDatabase();
        MySqlCommand cmd = new MySqlCommand();

        cmd.CommandText = "select " + column_name + " from " + table_name + " where find_in_set(" + value + "," + condition + ")"; //find_in_set(1,position)
        Debug_Log.Call_WriteLog(cmd.CommandText);
        cmd.Connection = SqlConnection;
        MySqlDataReader reader = cmd.ExecuteReader();

        while (reader.Read())
        {
            _Num = _Num + 1;
        }
        reader.Close();
        CloseDataBase();
        return(_Num);
    }
예제 #22
0
    /// <summary>
    /// 查询表数据
    /// </summary>
    /// <param name="tableName">表名</param>
    /// <param name="items">需要查询的列</param>
    /// <param name="whereColName">查询的条件列</param>
    /// <param name="operation">条件操作符</param>
    /// <param name="value">条件的值</param>
    /// <returns></returns>
    public DataSet Select(string tableName, string[] items, string[] whereColName, string[] operation, string[] value)
    {
        if (whereColName.Length != operation.Length || operation.Length != value.Length)
        {
            // throw new Exception("输入不正确:" + "col.Length != operation.Length != values.Length");
            Debug_Log.Call_WriteLog("输入不正确:" + "col.Length != operation.Length != values.Length");
        }
        string query = "SELECT " + items[0];

        for (int i = 1; i < items.Length; i++)
        {
            query += "," + items[i];
        }
        query += "  FROM  " + tableName + "  WHERE " + " " + whereColName[0] + operation[0] + " '" + value[0] + "'";
        for (int i = 1; i < whereColName.Length; i++)
        {
            query += " AND " + whereColName[i] + operation[i] + "' " + value[i] + "'";
        }
        return(QuerySet(query));
    }
예제 #23
0
    /// <summary>
    /// 插入部分ID
    /// </summary>
    /// <param name="tableName">表名</param>
    /// <param name="col">属性列</param>
    /// <param name="values">属性值</param>
    /// <returns></returns>
    public DataSet InsertInto(string tableName, string[] col, string[] values)
    {
        if (col.Length != values.Length)
        {
            // throw new Exception("columns.Length != colType.Length");
            Debug_Log.Call_WriteLog("输入不正确:" + "columns.Length != colType.Length");
        }
        string query = "INSERT INTO " + tableName + " (" + col[0];

        for (int i = 1; i < col.Length; ++i)
        {
            query += ", " + col[i];
        }
        query += ") VALUES (" + "'" + values[0] + "'";
        for (int i = 1; i < values.Length; ++i)
        {
            query += ", " + "'" + values[i] + "'";
        }
        query += ")";
        return(QuerySet(query));
    }
예제 #24
0
        private static string getInputFieldName(string strText)
        {
            string strReadText = "";

            try
            {
                GameObject mGameObjectAddUser = GameObject.Find("AddUser");
                GameObject objnamethis        = mGameObjectAddUser.transform.Find(strText).gameObject;
                GameObject GameObjectText     = objnamethis.transform.Find("Text").gameObject;

                strReadText = (GameObjectText.GetComponent <UnityEngine.UI.Text>().text);
                objnamethis.transform.Find("Text").GetComponent <UnityEngine.UI.Text>().text = "1111";
            }
            catch (Exception eee)
            {
                Debug_Log.Call_WriteLog(eee, "getInputFieldNameClassWriteUser", "Unity");
                Debug_Log.Call_WriteLog(strText, "getInputFieldNameClassWriteUser", "Unity");
            }

            return(strReadText);
        }
예제 #25
0
        public static ReadIniPar getParme()
        {
            ReadIniPar ddReadIniPardd = new ReadIniPar();

            #region 获取参数
            //获取ini文件

            int   LengthofTime = 0;
            int   speed        = 0;
            MyIni ini          = new MyIni();
            //获取Ini文件Time类型下的time对应的数值
            LengthofTime = ini.ReadIniContent("GameContent", "LengthofTime").toInt32(); ///SelectTrainTime
            speed        = ini.ReadIniContent("GameContent", "Speed").toInt32();        ///SelectTrainDifficulty
            string strContent = ini.ReadIniContent("GameContent", "Content");
            #endregion 获取参数
            ddReadIniPardd.LengthofTime = LengthofTime;
            ddReadIniPardd.speed        = speed;
            ddReadIniPardd.Content      = strContent;
            Debug_Log.Call_WriteLog(ddReadIniPardd, "读取的strpersistentDataPath", "Unity");


            return(ddReadIniPardd);
        }
예제 #26
0
    private void OnCollisionEnter(Collision collision)
    {
        //print(collision.collider.tag);
        if (collision.collider.tag == "EnemyGame")
        {
            GameObject objname = collision.collider.gameObject;



            //            Unity 3D 粒子播放
            //原创EW_DUST 最后发布于2018 - 12 - 03 21:18:33 阅读数 1346  收藏
            //    展开
            //查找子物体,并且将得到的物体转换成gameobject
            GameObject objnameLizi = objname.transform.parent.transform.Find("Falsh/ParticleSystemBlcok").gameObject;

            Debug_Log.Call_WriteLog("得到最终子物体的名字是:" + objname.name);

            objnameLizi.GetComponent <ParticleSystem>().Play(); //播放
                                                                //gameObject.GetCompoment<ParticleSystem>().Pause(); //暂停
                                                                //gameObject.GetCompoment<ParticleSystem>().Stop(); //停止

            //被撞得物体原点发出声音(第二个参数用来设置发出声音的世界坐标,不要离AudioListener太远)
            AudioSource.PlayClipAtPoint(AC, transform.localPosition);
            Destroy(objname);



            UnityEngine.UI.Text mTextFinisheText1 = GameObject.Find("FinisheText1").GetComponent <UnityEngine.UI.Text>();
            //UnityEngine.UI.Text mTextFinisheText2 = GameObject.Find("FinisheText2").GetComponent<UnityEngine.UI.Text>();

            Score.setSucessPercent(1);
            string strOK = Score.getSucessPercent();
            mTextFinisheText1.text = strOK;
            //mTextFinisheText2.text = strOK;
        }
    }
예제 #27
0
    /// <summary>
    /// 创建具有id自增的表
    /// </summary>
    /// <param name="name">表名</param>
    /// <param name="col">属性列</param>
    /// <param name="colType">属性列类型</param>
    /// <returns></returns>
    public bool CreateTableAutoID(string name, string[] col, string[] colType)
    {
        if (col.Length != colType.Length)
        {
            //  throw new Exception("columns.Length != colType.Length");
            Debug_Log.Call_WriteLog("输入不正确:" + "columns.Length != colType.Length");
        }
        string query = "CREATE TABLE  " + name + " (" + col[0] + " " + colType[0] + " NOT NULL AUTO_INCREMENT";

        for (int i = 1; i < col.Length; ++i)
        {
            query += ", " + col[i] + " " + colType[i];
        }
        query += ", PRIMARY KEY (" + col[0] + ")" + ")";

        if (ExecuteSqlCmd(query))
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
예제 #28
0
        public static void readAllDB()
        {
            try
            {
                //MySQLManager myDatabaseManager = new MySQLManager();
                //bool boolContest = myDatabaseManager.TestConnection();
                //GameObject mTextsearch = GameObject.Find("TextsearchSQL");
                //mTextsearch.GetComponent<UnityEngine.UI.Text>().text = boolContest;
                //Debug_Log.Call_WriteLog(boolContest);
                MySQLManager dddMySQLManager = new MySQLManager();
                ///int intK = dddMySQLManager.SqlRecordCount("select ID from medicaluser");
                System.Data.DataTable ddddmedicaluser = dddMySQLManager.QuerySet("select ID,Name,(CASE WHEN Sex ='1' THEN '男' ELSE '女' END) as Sex ,Age ,MedicalRecordNo,CreateTime from medicaluser where IsDeleted=0 order by id desc").Tables[0];
                int intK = ddddmedicaluser.Rows.Count;

                GameObject mUICanvas  = GameObject.Find("TableGameObjectAllText");
                int        childCount = mUICanvas.transform.childCount;
                for (int i = 0; i < childCount; i++)
                {
                    Transform child = mUICanvas.transform.GetChild(i);
                    UnityEngine.Object.Destroy(child.gameObject);
                }


                //Debug_Log.Call_WriteLog("child setClickButton..="+ childCount);
                //查找子物体,并且将得到的物体转换成gameobject
                //GameObject objname = mUICanvas.transform.FindChild("ImageOne/TextDB").gameObject;
                //objname.GetComponent<UnityEngine.UI.Text>().text = "dddd";
                //return;

                //var tmpSize = GameObject.Find("TableGameObjectAllText").GetComponent<RectTransform>().rect.height;
                ////GameObject.Find("TableGameObjectAllText").GetComponent<RectTransform>().sizeDelta = new Vector2(445,3000);
                //Debug_Log.Call_WriteLog(tmpSize);
                dtMenuLineBak.Clear();

                for (int i = 0; i < intK; i++)
                {
                    dtMenuLineBak.Add(null);
                }
                string LineImagebak = "Prefabs/ImageOne02";


                for (int i = 0; i < dtMenuLineBak.Count; i++)
                {
                    dtMenuLineBak[i] = (GameObject)UnityEngine.Object.Instantiate(Resources.Load(LineImagebak), new Vector3(0f, 0f, 0), Quaternion.identity);

                    dtMenuLineBak[i].transform.SetParent(mUICanvas.transform);
                    RectTransform rtr = dtMenuLineBak[i].GetComponent <RectTransform>();
                    //定义控件定位点相对基准位置的偏移

                    int intoff = 300 - i * 80 - 20;
                    if (dtMenuLineBak.Count > 7)
                    {
                        intoff = intoff + (dtMenuLineBak.Count - 8) * 40;
                    }

                    rtr.anchoredPosition = new Vector2(0, intoff);


                    Transform objnamethisTransform = dtMenuLineBak[i].transform;
                    objnamethisTransform.Find("OneNum").gameObject.GetComponent <UnityEngine.UI.Text>().text          = ddddmedicaluser.Rows[i]["ID"].ToString();
                    objnamethisTransform.Find("TwoName").gameObject.GetComponent <UnityEngine.UI.Text>().text         = ddddmedicaluser.Rows[i]["Name"].ToString();
                    objnamethisTransform.Find("ThreeSex").gameObject.GetComponent <UnityEngine.UI.Text>().text        = ddddmedicaluser.Rows[i]["Sex"].ToString();
                    objnamethisTransform.Find("FourAge").gameObject.GetComponent <UnityEngine.UI.Text>().text         = ddddmedicaluser.Rows[i]["Age"].ToString();
                    objnamethisTransform.Find("FiveHospitalNum").gameObject.GetComponent <UnityEngine.UI.Text>().text = ddddmedicaluser.Rows[i]["MedicalRecordNo"].ToString();
                    objnamethisTransform.Find("SixCreateTime").gameObject.GetComponent <UnityEngine.UI.Text>().text   = DateTime.Parse(ddddmedicaluser.Rows[i]["CreateTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                }
                if (dtMenuLineBak.Count > 0)
                {
                    maxtUserID = ddddmedicaluser.Rows[0]["ID"].toInt32();
                }
                //定义控件大小
                RectTransform rtrtable = mUICanvas.GetComponent <RectTransform>();
                rtrtable.sizeDelta = new Vector2(1617, dtMenuLineBak.Count * 80);
            }
            catch (Exception ex)
            {
                ////LogController.writeErrorLog(ex, "ObjectExtended toInt32");
                Debug_Log.Call_WriteLog(ex, "readAllDB");
            }
        }
예제 #29
0
 void OnTriggerExit(Collider c)
 {
     Debug_Log.Call_WriteLog("OnTriggerExit");
     gameObject.GetComponent <Renderer>().material.color = Color.green;
 }
예제 #30
0
 void OnTriggerEnter(Collider c)
 {
     Debug_Log.Call_WriteLog("OnTriggerEnter");
     //gameObject.GetComponent<Renderer>().material.color = Color.blue;
     gameObject.GetComponent <AudioSource>().Play();
 }