Commit 62f7b293 authored by Ever's avatar Ever

更新代码

parent f9d29f48
......@@ -1416,7 +1416,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 427, y: -82.500015}
m_AnchoredPosition: {x: 427, y: -82.5}
m_SizeDelta: {x: 87, y: 91}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &824212554
......@@ -4354,9 +4354,9 @@ MonoBehaviour:
m_HandleRect: {fileID: 5101221413184368358}
m_Direction: 0
m_MinValue: 0
m_MaxValue: 100
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 100
m_Value: 1
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
......@@ -6408,7 +6408,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3396359898559686475}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 582a8965e0faeec4a8df7d0271769c6d, type: 3}
m_Name:
......
......@@ -26,14 +26,18 @@ public class LoadingPanel : MonoBehaviour
private void ClosePanel(object[] values)
{
JIndu.value = 1;
StartCoroutine(DelayClose());
if (gameObject.activeSelf)
{
JIndu.value = 1;
StartCoroutine(DelayClose());
}
}
IEnumerator DelayClose()
{
yield return new WaitForSeconds(0.2f);
gameObject.SetActive(false);
JIndu.value = 0;
}
float jindu = 0;
private void ChangeSlider(object[] values)
......
......@@ -90,7 +90,7 @@ public class gameSceneLogic : MonoBehaviour, IEventHandler
transform.Find("gameEndOperBase").gameObject.SetActive(false);
transform.Find("gameEndOperBase").GetComponent<gameEndLogic>().initMember();
transform.Find("areaGroupList/tipSelectGroup").gameObject.SetActive(false);
transform.Find("top").gameObject.SetActive(false);
//transform.Find("top").gameObject.SetActive(false);
utilsTools.setGDataByKey(EventName.DataName.Data_PhoneOffsetValue, 50);
utilsTools.addTimer_Sec(gameObject, "loopGetHot", (String name) =>
{
......
......@@ -7,6 +7,7 @@ using UnityEngine.UI;
using System.Linq;
using DG.Tweening;
using TMPro;
using static UnityEditor.Progress;
public class GroupListManager : MonoBehaviour
{
......@@ -50,39 +51,91 @@ public class GroupListManager : MonoBehaviour
private void GroupItemChange(object[] values)
{
RoomGroupsData data = (RoomGroupsData)values[0];
float Jindu = 0.4f;
float Jindu = (float)data.roomIdsOver.Count/((float)data.roomIds.Count+ (float)data.roomIdsOver.Count);
var item = AllItem.FirstOrDefault((a) => { return a.GID == data.id; });
if (item != null)
{
item.ChangeProgress(Jindu);
if (Jindu >= 1)
{
RemoveAGroup(item);
}
}
}
private void RemoveAGroup(colorItem item)
{
AllItem.Remove(item);
item.transform.DOScale(Vector3.zero, 0.3f).onComplete = () =>
{
item.gameObject.SetActive(false);
};
//var nowselect= AllItem.FirstOrDefault(()=>)
for (int i = 0; i < AllItem.Count; i++)
{
var ite = AllItem[i];
if (ite.index > item.index)
{
ite.index--;
ite.transform.DOLocalMoveX(ite.transform.localPosition.x - item.transform.GetComponent<RectTransform>().rect.x, 0.3f);
}
}
}
private void CreateGroup(object[] values)
{
List<RoomGroupsData> roomGroupsData = (List<RoomGroupsData>)values[0];
int AllGroupNum = roomGroupsData.Count; //总的组个数
float NowJindu = 0.4f; //现在的进度
float NowJindu = 0f; //现在的进度
Transform tran;
int index = 0;
int childCount = Content.transform.childCount;
foreach (var item in roomGroupsData)
AllItem.Clear();
for (int i = 0; i < childCount; i++)
{
tran = GameObject.Instantiate(GroupItem_Obj).transform;
tran.SetParent(Content.transform);
tran.localPosition = Vector3.zero;
tran.localRotation = Quaternion.Euler(0, 0, 0);
tran.localScale = Vector3.one;
//NowJindu = (float)item.roomIdsOver.Count / item.roomIds.Count + item.roomIdsOver.Count;
var coloritem = tran.GetComponent<colorItem>();
coloritem.Init(new Color(item.R, item.G, item.B)/255f, NowJindu,item.id);
coloritem.index = index;
index++;
AllItem.Add(coloritem);
Content.transform.GetChild(i).gameObject.SetActive(false);
}
if (childCount >= AllGroupNum)
{
foreach (var item in roomGroupsData)
{
tran = Content.transform.GetChild(index);
NowJindu = (float)item.roomIdsOver.Count / (item.roomIds.Count + item.roomIdsOver.Count);
var coloritem = InitItem(tran, new Color(item.R, item.G, item.B) / 255f, NowJindu, item.id);
coloritem.index = index;
index++;
AllItem.Add(coloritem);
}
}
else
{
for (int i = 0; i < childCount; i++)
{
tran = Content.transform.GetChild(index);
var item = roomGroupsData[index];
NowJindu = (float)item.roomIdsOver.Count / (item.roomIds.Count + item.roomIdsOver.Count);
var coloritem = InitItem(tran, new Color(item.R, item.G, item.B) / 255f, NowJindu, item.id);
coloritem.index = index;
index++;
AllItem.Add(coloritem);
}
AllGroupNum = roomGroupsData.Count - AllItem.Count;
for (int i = 0; i < AllGroupNum; i++)
{
var item = roomGroupsData[index];
tran = GameObject.Instantiate(GroupItem_Obj).transform;
NowJindu = (float)item.roomIdsOver.Count / (item.roomIds.Count + item.roomIdsOver.Count);
var coloritem = InitItem(tran, new Color(item.R, item.G, item.B) / 255f, NowJindu, item.id);
coloritem.index = index;
index++;
AllItem.Add(coloritem);
}
}
EventDispatcher.Dispatch(EventName.Event.Event_LoadingPanelCLose);
StartCoroutine(Delay());
......@@ -97,6 +150,18 @@ public class GroupListManager : MonoBehaviour
item.PlayInitAni();
}
}
private colorItem InitItem(Transform tran,Color color,float Jindu,int gid)
{
tran.SetParent(Content.transform);
tran.localPosition = Vector3.zero;
tran.localRotation = Quaternion.Euler(0, 0, 0);
tran.localScale = Vector3.one;
tran.gameObject.SetActive(true);
var coloritem = tran.GetComponent<colorItem>();
coloritem.Init(color, Jindu, gid);
return coloritem;
}
private int nowidx = 0;
private int oldindex = 0;
......
......@@ -13,7 +13,7 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
[SerializeField]
private bool isSelect = false;
[SerializeField]
private float nowProgress = 0;
private float targetProgress = 0;
[SerializeField]
private string idName = "";
[SerializeField]
......@@ -76,10 +76,13 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
CreateMat();
}
nowvalue = Jindu;
NowProgress = Jindu;
UseColor = color;
GID = groupid;
IdName = groupid.ToString();
Image_Jindu.material.SetFloat("progress", Jindu);
}
public void ChangeProgress(float jindu)
......@@ -109,29 +112,32 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
}
public float NowProgress
{
set {
if (value <= 0)
value = 0f;
else if (value >= 0.99999998)
value = 1.0f;
if (utilsTools.isEqualByValue(value, 1, 0.000001f))
{
value = 1.0f;
}
nowProgress = value;
bool isend = this.isFinish();
//effectImg.Height = 1.0f - nowProgress;
//effectImg.Height = nowProgress;
Image_Jindu.material.SetFloat("progress", nowProgress);
transform.Find("idname").gameObject.SetActive(!isend);
set
{
targetProgress = value;
//Image_Jindu.material.SetFloat("progress", targetProgress);
}
get
{
return nowProgress;
return targetProgress;
}
}
private float nowvalue;
private void Update()
{
if (targetProgress > nowvalue)
{
nowvalue += Time.deltaTime / 2f;
if (targetProgress <= nowvalue)
{
nowvalue = targetProgress;
}
Image_Jindu.material.SetFloat("progress", nowvalue);
}
}
public string IdName
{
set {
......@@ -194,10 +200,6 @@ public class colorItem : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
transform.localScale = Vector3.one * NotSelectScale;
}
public bool isFinish()
{
return utilsTools.isEqualByValue(nowProgress,1.0f,0.0000002f);
}
public void onClickAreaGroup()
{
if (IsSelect)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment