WolfPanel脚本
定义成员变量
GTextField killNumber,GGroup numberButtons,Transition killTransition
WolfPanel脚本
定义成员变量
GTextField killNumber,GGroup numberButtons,Transition killTransition
找不到Manager可以刷新解决方案,可以不必关闭VS
WolfPanel脚本
1.OnInitPanel函数添加
certainButton.onClick.Add(()=>{
controller.selectedIndex=2;
messageController.selectedIndex=2;
transition.Stop();
killTransition.Play(()=>{
killNumber.text=0.ToString();
AfterAction(UIPanelType.witchPanel);});});
2.HandleGameAction(UIPanelType currentGamePanelType){
if(currentGamePanelType==UIPanelType.WolfPanel){
ToCurrentPanel();transition.Play(-1,0,()=>{});
for((int i=0;i<contentPane.numChildren;i++){
for(int j=0;j<messageManager.deadPlayerNum.Count;j++)
{
if(contentPane.GetChildAt(i).group==numberButtons){GButton gButton=contentPane.GetChildAt(i).asButton;
if(gButton.title==messageManager.deadPlayerNum[j].ToString()){
gButton.grayed=true;gButton.touchable=false;}
}}}}}
完善UIManager
1.GameUIManager()
定义GameBasePanel
dayNightPanel,wolfPanel,guardPanel,witchPanel,prophetPanel,hunterPanel
完善任务链wolfPanel.SetNextPanel(witchPanel).SetNextPanel(prophetPanel).SetNextPanel(hunterPanel).SetNextPanel(defenderPanel).SetNextPanel(dayNightPanel).SetNextPanel(wolfPanel);
字典添加界面内容
UIPanelDict[UIPanelTypeWolfPanel].Show();
GameBasePanel firstPanel=UIPanelDict[UIPanelType.WolfPanel] as GameBasePanel;
firstPanel.EnterPanel();
firstPanel.HandleGameAcition(UIPanel.WolfPanel);
2.BasePanel()
ChangePanelCallBack(UIPanelType otherPanel)函数增加
if(uiManager.isGameUIManager){
GameBasePanel nextPanel=uiManager.UIPanelDict[otherPanel] as GameBasePanel;
nextPanel.HandleGameAction(otherPanel);}
1.GameBasePanel脚本
在构造方法中,加入
messageManager=GameManager.Instance.messageManager;
if(uiPanelType==UIPanelType.DayNightPanel){isDayNightPanel=true;}
2.OnInitPanel方法
if(!isDayNightPanel){
openAnimCom,closeAnimCom,openEye,closeEye,certainButton获取
}
guideMessage,messageController,controller
3.public virtual void HandleGameAction(UIPanelType currentGamePanelType){}
4.public virtual void ToCurrentPanel()
{controller.selectedIndex=0;
messageController.selectedIndex=0;
openEye.visible=true;
closeEye.visible=false;
openEye.SetPlaySettings(1,16,1,1);
openEye.playing=true;
if(firstTimeInThisPanel)
{openEye.onPlayEnd.Add(()=>{controller.selectedIndex=1;messageController.selectedIndex=1;openEye.visible=false;})}
}
GameBasePanel补充
AfterAction(UIPanelType nextPanel){
if(!isDayNightPanel){
controller.selectedIndex=3;
messageController.selectedIndex=3;}
else{
controller.selectedIndex=8;}
ToNextPanel(nextPanel);}
ToNextPanel(UIPanelType nextPanel){
if(!isDayNightPanel){
closeEye.visible=true;
if(firstTimeInThisPanel){
firstTimeInThisPanel=false;
closeEye.onPlayEnd.Add(()=>{ToOtherPanel(nextType);
closeEye.visibl=false;});}
closeEye.SetPlaySettings(1,9,1,9);
closeEye.Playing=true;}
else{
Transition ToNight=contentPane.GetTransition("ToNight");
ToNight.play(()=>{ToOtherPanel(nextType);});}}
补充UIManager脚本
1.GameUIManager()
{isGameUIManager=true;
if(UIPanelDict.Count!=0){
ClearDict();}}
2.GamePanel文件夹添加脚本继承GameBasePanel
DayNigth,GuardPanel,Hunter,Prophet,Witch,Wolf;
sin 是锐角的对边比斜边
cos 定义是 锐角的邻边比斜边
tan 直角三角形中,锐角对应对边比邻边
推导 Cos 45°
根据勾股定理 a² + b² = c²
斜边 c² =^a² + b²
如果两条边都为1 ,即斜边 ^2
为了计算简化 分母有理化,是针对分母有无理数或无理式的分式而言的,分母有理化也就是把分式的分母变成有理数或有理式的过程。
上下分别乘以根号2
^2/2 是 分母有理化的来
Cos 45° = ^2/2
将好几个物体合并mesh
获取子物体中的meshfilter组件
创建combineinstance组件
for循环赋予combineinstance
sharemesh,局部赚世界的矩阵坐标transform.localtoworldmatrix
创建一个mesh mesh.combinemeshs
这节是贴图 然后可以加实时的阴影
Directional Light 平行光
AndroidJavaClass unityPlayer=new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity=unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaClass toast=new AndroidJavaClass("android.widget.Toast");
AndroidJavaObject context=currentActivity.Call<AndroidjavaObject>("getApplicationContext");
currentActivity.Call("runOnUiThread",new AndroidJavaRunnable(()=>{
tocsat.CallStatic<AndroidJavaObject>("makeText",context,"send...",tocast.GetStatic<int>("LENGTH_LONG")).Call("show");
}));
笛卡尔坐标系:
1.笛卡尔直角坐标系
2.笛卡尔斜角坐标系
3.笛卡尔坐标系的度量单位一致
4.第一象限++,第二象限-+,第三象限+-,第四--
1.Game场景调整Camera设置
2.定义GameBasePanel脚本
protected GComponent openAnimCom,closeAnimCom,guideMessage,
GMovieClip openEye,closeEye
bool firstTimeInThisPanel,isDayNightPanel;
protected GameBasePanel nextPanel;
GameBasePanel SetNextPanel(GameBasePanel nextGamePanel){nextPanel=nextGamePanel;return nextPanel;}
protected Controller messageController,MessageManager messageManager,GButton certainButton;
1.卡牌翻转效果Turn();
private void Turn()
{
if (DOTween.IsTweening(cardButton))
{
return;
}
toOpen = !toOpen;
DOTween.To(() => 0, x =>
{
if (toOpen)
{
cardBack.rotationY = x;
cardFront.rotationY = -180 + x;
if (x > 90)
{
cardBack.visible = true;
cardFront.visible = false;
}
}
else
{
cardBack.rotationY = -180 + x;
cardFront.rotationY = x;
if (x > 90)
{
cardBack.visible = false;
cardFront.visible = true;
}
}
}, 180, 0.5f).SetTarget(cardButton).SetEase(Ease.OutQuad);
}
GamePanel脚本
RotateCard方法完善
1.GamePanel脚本内变量赋值。
2.ShuffleTheCard(){
int count=0;
while(count<12){
int r=Random.range(1,13);
for(int i=0;i<randomList.Length;i++){
if(randomList[i]==r){
isTheSame=true;
break;
}
}
if(!isTheSame){
randomList[count]=r;
count++;}
isTheSame=false;
}
}
3.定义RotateCard()方法
1.定义GamePanel成员变量
transition star,loadAnim;GButton cardButton;GObject cardFront,cardBack;GComponent guideMessage;Controller messageController;GTextField tex_Number,tex_ID;bool toOpen=true;
2.1-4为狼,5-8为民,9预言家,10女巫,11猎人,12守卫
int[] RandomList=new in[12];bool isTheSame;int index,wolfIndex,villagersIndex
HelpPanel脚本
1.ShowIDInformation(int id)函数