Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liangxiegame/qcsharpstyleguide
https://github.com/liangxiegame/qcsharpstyleguide
csharp unity unity3d
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/liangxiegame/qcsharpstyleguide
- Owner: liangxiegame
- License: mit
- Created: 2017-09-10T11:58:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-25T08:04:38.000Z (over 6 years ago)
- Last Synced: 2024-10-11T09:58:05.168Z (3 months ago)
- Topics: csharp, unity, unity3d
- Size: 3.91 KB
- Stars: 43
- Watchers: 8
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#### ProgramingStyle
~~~c#
/****************************************************************************
* Copyright (c) 2017 liangxieq (填写自己的 github id/或者昵称)
* Copyright (c) 2018.5 karsion (要注明最后维护者)
* https://github.com/liangxiegame/QCSharpStyleGuide (git 地址要注明)
* http://liangxiegame.com (当然也可以署上自己的博客)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
****************************************************************************/
namespace QFramework.Example
{
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
///
/// 展示编码风格
///
public class ProgrammingStyle : MonoBehaviour
{
#region Basic App
///
/// 私有成员变量不做限制
///
[SerializeField] Button mBtnEnterMainPage;///
/// public类型使用首字母大写驼峰式
///
public int LastIndex = 0;///
/// public 类型属性也算public类型变量
///
public int CurSelectIndex
{
get { return mCurSelectIndex; }
}void Start ()
{
mBtnEnterMainPage = transform.Find ("BtnEnterMainPage").GetComponent();// GameObject命名
// 临时变量命名采用首字母小写驼峰式
GameObject firstPosGo = transform.Find ("FirstPosGo").gameObject;
}///
/// 方法名一律首字母大写驼峰式
///
public void Hide()
{
gameObject.SetActive (false);
}
#endregion#region Advanced
/*
* GameObject->Go
* Transform->Trans
* Button->Btn
*
* For->4
* To->2
* Dictionary->Dict
* Number->Num
* Current->Cur
*////
/// 1.Bg肯定是图片
///
[SerializeField] Image mBg;///
/// GameObject->Go
///
[SerializeField] GameObject mDialogGo;///
/// Transfom->Trans
///
[SerializeField] Transform mScrollViewTrans;///
/// Index、Num、Count等肯定是int
///
[SerializeField] int mCurSelectIndex;///
/// RectTransform->RectTrans;
///
[SerializeField] RectTransform mScrollContentRectTrans;///
/// 1.Pos肯定是Vector3、Vector2
/// 2.Size肯定是Vector2
///
[SerializeField] Vector3 mCachedPos;
[SerializeField] Vector2 mCachedSize;///
/// 后缀s表示是个数组
///
[SerializeField] Vector3[] mCachedPositions;///
/// 1.List后缀
/// 2.4->for 表示所属关系可以表示Dict
/// 3.Dict后置
///
[SerializeField] List mCachedPosList;
[SerializeField] Dictionary mPos4ChildName;
[SerializeField] Dictionary mChildPosDict;
#endregion
}
}
~~~