Пример #1
0
    public void SetupOponetInfo(RaceButton Button)
    {
        if (Button)
        {
            if (OponentsContainer == null)
            {
                OponentsContainer = GameObject.FindGameObjectWithTag("OponentsContainer");
            }

            ScenesToLoad = Button.ScenesToLoad;

            if (OponentsContainer)
            {
                for (int i = 0; i < OponentsContainer.transform.childCount; i++)
                {
                    GameObject OponentRace = OponentsContainer.transform.GetChild(i).gameObject;

                    OponentRaceInfo RaceInfo = OponentRace.GetComponent <OponentRaceInfo>();

                    RaceInfo.CarInfo.Acceleration = Button.Oponents[i].Acceleration;
                    RaceInfo.CarInfo.TopSpeed     = Button.Oponents[i].TopSpeed;
                    RaceInfo.CarInfo.Handling     = Button.Oponents[i].Handling;
                    RaceInfo.CarInfo.Drive        = Button.Oponents[i].Drive;
                    RaceInfo.CarInfo.Tyres        = Button.Oponents[i].Tyres;
                    RaceInfo.CarInfo.CarImage     = Button.Oponents[i].CarImage;
                    RaceInformations[i]           = RaceInfo;

                    OponentCarStats[i].Acceleration = Button.Oponents[i].Acceleration;
                    OponentCarStats[i].TopSpeed     = Button.Oponents[i].TopSpeed;
                    OponentCarStats[i].Handling     = Button.Oponents[i].Handling;
                    OponentCarStats[i].Drive        = Button.Oponents[i].Drive;
                    OponentCarStats[i].Tyres        = Button.Oponents[i].Tyres;
                    OponentCarStats[i].CarImage     = Button.Oponents[i].CarImage;
                }
            }
        }
    }
Пример #2
0
    void SequenceData_Void()
    {
        List <CPACK_RACE_EventData> SaveDataList = new List <CPACK_RACE_EventData>(CompetitionData.Values);

        List <CPACK_RACE_EventData> FitstList = new List <CPACK_RACE_EventData>();
        List <CPACK_RACE_EventData> SignList  = new List <CPACK_RACE_EventData>();
        List <CPACK_RACE_EventData> OtherList = new List <CPACK_RACE_EventData>();
        List <CPACK_RACE_EventData> EndList   = new List <CPACK_RACE_EventData>();

        SinedOK_Bool = false;

        foreach (var item in SaveDataList)
        {
            if (item.m_bSigned && (item.m_oSwitchState.m_enumState == ENUM_RACE_STATE.WaitStart || item.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Racing))
            {
                FitstList.Add(item);
            }
            else if (item.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
            {
                SignList.Add(item);
            }
            else if (item.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
            {
                EndList.Add(item);
            }
            else if (!item.m_bSigned)
            {
                OtherList.Add(item);
            }
        }
        SaveDataList.Clear();

        if (ListObject.Count != 0)
        {
            foreach (GameObject item in ListObject.Values)
            {
                Destroy(item);
            }
            ListObject.Clear();
            SequenceData.Clear();
        }

        if (FitstList.Count != 0)
        {
            for (ushort i = 0; i < FitstList.Count; i++)
            {
                SequenceData.Add(FitstList[i].m_oSwitchState.m_usEventID, FitstList[i]);
            }
        }

        //對報名做排序
        if (SignList.Count != 0)
        {
            SignList.Sort(delegate(CPACK_RACE_EventData x, CPACK_RACE_EventData y)
            {
                if (x.m_oSwitchState.m_timeNext == null && y.m_oSwitchState.m_timeNext == null)
                {
                    return(0);
                }
                else if (x.m_oSwitchState.m_timeNext == null)
                {
                    return(-1);
                }
                else if (y.m_oSwitchState.m_timeNext == null)
                {
                    return(1);
                }
                else
                {
                    if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
                    {
                        return((x.m_oSwitchState.m_timeNext.AddMinutes(-x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(-y.m_uiWaitSignMinute)));
                    }
                    else if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
                    {
                        return((x.m_oSwitchState.m_timeNext.AddMinutes(-x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(y.m_uiWaitSignMinute)));
                    }
                    else
                    {
                        return(x.m_oSwitchState.m_timeNext.CompareTo(y.m_oSwitchState.m_timeNext));
                    }
                }
            });

            for (ushort i = 0; i < SignList.Count; i++)
            {
                SequenceData.Add(SignList[i].m_oSwitchState.m_usEventID, SignList[i]);
            }
        }

        //對比賽結束做排序
        if (EndList.Count != 0)
        {
            EndList.Sort(delegate(CPACK_RACE_EventData x, CPACK_RACE_EventData y)
            {
                if (x.m_oSwitchState.m_timeNext == null && y.m_oSwitchState.m_timeNext == null)
                {
                    return(0);
                }
                else if (x.m_oSwitchState.m_timeNext == null)
                {
                    return(-1);
                }
                else if (y.m_oSwitchState.m_timeNext == null)
                {
                    return(1);
                }
                else
                {
                    if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
                    {
                        return((x.m_oSwitchState.m_timeNext.AddMinutes(x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(-y.m_uiWaitSignMinute)));
                    }
                    else if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
                    {
                        return((x.m_oSwitchState.m_timeNext.AddMinutes(x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(y.m_uiWaitSignMinute)));
                    }
                    else
                    {
                        return(x.m_oSwitchState.m_timeNext.CompareTo(y.m_oSwitchState.m_timeNext));
                    }
                }
            });

            for (ushort i = 0; i < EndList.Count; i++)
            {
                SequenceData.Add(EndList[i].m_oSwitchState.m_usEventID, EndList[i]);
            }
        }

        //對比賽中做排序
        if (OtherList.Count != 0)
        {
            OtherList.Sort(delegate(CPACK_RACE_EventData x, CPACK_RACE_EventData y)
            {
                if (x.m_oSwitchState.m_timeNext == null && y.m_oSwitchState.m_timeNext == null)
                {
                    return(0);
                }
                else if (x.m_oSwitchState.m_timeNext == null)
                {
                    return(-1);
                }
                else if (y.m_oSwitchState.m_timeNext == null)
                {
                    return(1);
                }
                else
                {
                    return(x.m_oSwitchState.m_timeNext.CompareTo(y.m_oSwitchState.m_timeNext));
                }
            });

            for (ushort i = 0; i < OtherList.Count; i++)
            {
                SequenceData.Add(OtherList[i].m_oSwitchState.m_usEventID, OtherList[i]);
            }
        }
        #region ListSort
        //SaveDataList.Sort(delegate (CPACK_RACE_EventData x, CPACK_RACE_EventData y)
        //{
        //    if (x.m_oSwitchState.m_timeNext == null && y.m_oSwitchState.m_timeNext == null) return 0;
        //    else if (x.m_oSwitchState.m_timeNext == null) return -1;
        //    else if (y.m_oSwitchState.m_timeNext == null) return 1;
        //    else if (x.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
        //    {
        //        if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
        //        {
        //            return (x.m_oSwitchState.m_timeNext.AddMinutes(x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(-y.m_uiWaitSignMinute));
        //        }
        //        else if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
        //        {
        //            return (x.m_oSwitchState.m_timeNext.AddMinutes(x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(y.m_uiWaitSignMinute));
        //        }
        //        else
        //        {
        //            return x.m_oSwitchState.m_timeNext.CompareTo(y.m_oSwitchState.m_timeNext);
        //        }
        //    }
        //    else if (x.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
        //    {
        //        if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
        //        {
        //            return (x.m_oSwitchState.m_timeNext.AddMinutes(-x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(-y.m_uiWaitSignMinute));
        //        }
        //        else if (y.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
        //        {
        //            return (x.m_oSwitchState.m_timeNext.AddMinutes(-x.m_uiWaitSignMinute)).CompareTo(y.m_oSwitchState.m_timeNext.AddMinutes(y.m_uiWaitSignMinute));
        //        }
        //        else
        //        {
        //            return x.m_oSwitchState.m_timeNext.CompareTo(y.m_oSwitchState.m_timeNext);
        //        }
        //    }
        //    else return x.m_oSwitchState.m_timeNext.CompareTo(y.m_oSwitchState.m_timeNext);
        //});
        #endregion

        //for (ushort i = 0; i < SaveDataList.Count; i++)
        //{
        //    SequenceData.Add(SaveDataList[i].m_oSwitchState.m_usEventID, SaveDataList[i]);
        //}

        #region ObjectAdd
        byte Number = 0;
        foreach (var item in SequenceData)
        {
            GameObject Data = Instantiate(RaceObject);

            Data.transform.parent     = CompetitionTable.transform;
            Data.transform.localScale = new Vector3(1, 1, 1);
            if (Number < 10)
            {
                Data.name = "0" + Number.ToString();
            }
            else
            {
                Data.name = Number.ToString();
            }
            RaceData   m_RaceData     = Data.GetComponent <RaceData>();
            RaceButton Data_cs        = m_RaceData.RaceDataButton.GetComponent <RaceButton>();
            string     SaveDate       = item.Value.m_oSwitchState.m_timeNext.ToString("M/d");
            string     SaveStartTime  = "";
            string     SaveEndTime    = "";
            string     SaveStartTime2 = "";
            string     SaveEndTime2   = "";
            if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
            {
                SaveStartTime  = item.Value.m_oSwitchState.m_timeNext.AddMinutes(-item.Value.m_uiWaitSignMinute).ToString("HH:mm");
                SaveEndTime    = item.Value.m_oSwitchState.m_timeNext.ToString("HH:mm");
                SaveStartTime2 = item.Value.m_oSwitchState.m_timeNext.AddMinutes(-item.Value.m_uiWaitSignMinute).ToString("HH:mm");
                SaveEndTime2   = item.Value.m_oSwitchState.m_timeNext.ToString("HH:mm");
                m_RaceData.People_Label.text = item.Value.m_uiNowPlayerCnt + "人 / " + item.Value.m_uiMaxPlayerCnt + "人";
            }
            else if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
            {
                SaveStartTime  = item.Value.m_oSwitchState.m_timeNext.ToString("HH:mm");
                SaveEndTime    = item.Value.m_oSwitchState.m_timeNext.AddMinutes(item.Value.m_uiWaitSignMinute).ToString("HH:mm");
                SaveStartTime2 = item.Value.m_oSwitchState.m_timeNext.ToString("HH:mm");
                SaveEndTime2   = item.Value.m_oSwitchState.m_timeNext.AddMinutes(item.Value.m_uiWaitSignMinute).ToString("HH:mm");
                m_RaceData.People_Label.text = "0人 / " + item.Value.m_uiMaxPlayerCnt + "人";
            }
            else
            {
                SaveStartTime = "0";
                SaveEndTime   = "0";
                m_RaceData.People_Label.text = item.Value.m_uiNowPlayerCnt + "人 / " + item.Value.m_uiMaxPlayerCnt + "人";
            }

            m_RaceData.ID                     = item.Key;
            m_RaceData.RaceTime               = SaveDate + " " + SaveEndTime;
            m_RaceData.RACE_EVENT_TYPE        = item.Value.m_oSwitchState.m_enumState;
            m_RaceData.m_RACE_EVENT_TYPE      = item.Value.m_enumEventType;
            m_RaceData.Date_Label.text        = SaveDate + "  " + item.Value.m_strEventName;
            m_RaceData.ApplyTime_Label.text   = SaveDate + " " + SaveStartTime;
            m_RaceData.StartTime_Label.text   = SaveEndTime;
            m_RaceData.Round_Label.text       = item.Value.m_uiEventRound.ToString();
            m_RaceData.MaxPlayerCnt           = item.Value.m_uiMaxPlayerCnt;
            m_RaceData.Cost_Label.text        = item.Value.m_uiFeeVal.ToString();
            m_RaceData.Explanation_Label.text = item.Value.m_strInfo;

            m_RaceData.RaceName           = item.Value.m_strEventName;
            m_RaceData.ENUM_RACE_FEE_TYPE = item.Value.m_enumFeeType;
            m_RaceData.uiFeeVal           = item.Value.m_uiFeeVal;
            m_RaceData.Signed_Bool        = item.Value.m_bSigned;
            if (item.Value.m_bSigned && item.Value.m_oSwitchState.m_enumState != ENUM_RACE_STATE.End)
            {
                SinedOK_Bool = true;
            }

            ListObject.Add(m_RaceData.ID, Data);
            if (Number == 0)
            {
                if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
                {
                    NextRace_Label[0].text = SaveDate + "  " + item.Value.m_strEventName + Name1;
                }
                else if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.WaitStart || item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Racing)
                {
                    NextRace_Label[0].text = SaveDate + "  " + item.Value.m_strEventName + Name2;
                }
                else if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
                {
                    NextRace_Label[0].text = SaveDate + "  " + SaveStartTime2 + "~" + SaveEndTime2 + "  " + item.Value.m_strEventName;
                }
            }
            else if (Number == 1)
            {
                if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Sign)
                {
                    NextRace_Label[1].text = SaveDate + "  " + item.Value.m_strEventName + Name1;
                }
                else if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.WaitStart || item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.Racing)
                {
                    NextRace_Label[1].text = SaveDate + "  " + item.Value.m_strEventName + Name2;
                }
                else if (item.Value.m_oSwitchState.m_enumState == ENUM_RACE_STATE.End)
                {
                    NextRace_Label[1].text = SaveDate + "  " + SaveStartTime2 + "~" + SaveEndTime2 + "  " + item.Value.m_strEventName;
                }
            }
            Number++;
        }
        #endregion
        BarCheck_Bool = true;
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        RaceButton Data_cs = RaceDataButton.GetComponent <RaceButton>();

        Data_cs.ButtonSigned_Bool = Signed_Bool;
        Data_cs.ButtonType        = RACE_EVENT_TYPE;
        Data_cs.ButtonID          = ID;
        Data_cs.FeeType           = ENUM_RACE_FEE_TYPE;
        Data_cs.FeeVal            = uiFeeVal;
        Data_cs.RaceButtonName    = RaceName;
        Data_cs.RaceButtonTime    = RaceTime;
        RaceButton Data_cs2 = RaceInfoButton.GetComponent <RaceButton>();

        Data_cs2.ButtonSigned_Bool = Signed_Bool;
        Data_cs2.ButtonType        = RACE_EVENT_TYPE;
        Data_cs2.ButtonID          = ID;
        Data_cs2.FeeType           = ENUM_RACE_FEE_TYPE;
        Data_cs2.FeeVal            = uiFeeVal;
        Data_cs2.RaceButtonName    = RaceName;
        Data_cs2.RaceButtonTime    = RaceTime;

        if (RACE_EVENT_TYPE == ENUM_RACE_STATE.Sign && !Signed_Bool)
        {
            ButtonSprite.spriteName = "btn_bglgamelistA_0";
            if (Competition.SinedOK_Bool)
            {
                m_Button.SetActive(false);
            }
            else
            {
                m_Button.SetActive(true);
            }
            m_ExplainButton.SetActive(true);
            m_Button.transform.localPosition = new Vector3(595, -80, 0);
        }
        else if (RACE_EVENT_TYPE == ENUM_RACE_STATE.Sign && Signed_Bool)
        {
            ButtonSprite.spriteName = "btn_bglgamelistD_0";
            m_Button.SetActive(true);
            m_ExplainButton.SetActive(true);
            m_Button.transform.localPosition = new Vector3(595, -80, 0);
        }
        else if (RACE_EVENT_TYPE == ENUM_RACE_STATE.WaitStart || RACE_EVENT_TYPE == ENUM_RACE_STATE.Racing)
        {
            if (VersionDef.InternationalLanguageSystem)
            {
                ApplyTime_Label.text = Font_Control.Instance.m_dicMsgStr[2008092];
                StartTime_Label.text = Font_Control.Instance.m_dicMsgStr[2008093];
            }
            else
            {
                ApplyTime_Label.text = "已截止";
                StartTime_Label.text = "比賽進行中";
            }
            ButtonSprite.spriteName = "btn_bglgamelistC_0";
            if (!Signed_Bool)
            {
                m_Button.SetActive(false);
            }
            m_ExplainButton.SetActive(false);
            m_Button.transform.localPosition = new Vector3(595, -126, 0);
        }
        else if (RACE_EVENT_TYPE == ENUM_RACE_STATE.End)
        {
            ButtonSprite.spriteName = "btn_bglgamelistE_0";
            if (!Signed_Bool)
            {
                m_Button.SetActive(false);
            }
            m_ExplainButton.SetActive(false);
            m_Button.transform.localPosition = new Vector3(595, -126, 0);
        }
    }
Пример #4
0
        void ReleaseDesignerOutlets()
        {
            if (AbilityArea != null)
            {
                AbilityArea.Dispose();
                AbilityArea = null;
            }

            if (AlignmentButton != null)
            {
                AlignmentButton.Dispose();
                AlignmentButton = null;
            }

            if (CharismaButton != null)
            {
                CharismaButton.Dispose();
                CharismaButton = null;
            }

            if (ClassButton != null)
            {
                ClassButton.Dispose();
                ClassButton = null;
            }

            if (ConstitutionButton != null)
            {
                ConstitutionButton.Dispose();
                ConstitutionButton = null;
            }

            if (CRButton != null)
            {
                CRButton.Dispose();
                CRButton = null;
            }

            if (CreatureSubtypeButton != null)
            {
                CreatureSubtypeButton.Dispose();
                CreatureSubtypeButton = null;
            }

            if (CreatureTypeButton != null)
            {
                CreatureTypeButton.Dispose();
                CreatureTypeButton = null;
            }

            if (DexterityButton != null)
            {
                DexterityButton.Dispose();
                DexterityButton = null;
            }

            if (HeaderArea != null)
            {
                HeaderArea.Dispose();
                HeaderArea = null;
            }

            if (InitButton != null)
            {
                InitButton.Dispose();
                InitButton = null;
            }

            if (IntelligenceButton != null)
            {
                IntelligenceButton.Dispose();
                IntelligenceButton = null;
            }

            if (NameButton != null)
            {
                NameButton.Dispose();
                NameButton = null;
            }

            if (RaceButton != null)
            {
                RaceButton.Dispose();
                RaceButton = null;
            }

            if (SensesButton != null)
            {
                SensesButton.Dispose();
                SensesButton = null;
            }

            if (SizeButton != null)
            {
                SizeButton.Dispose();
                SizeButton = null;
            }

            if (StrengthButton != null)
            {
                StrengthButton.Dispose();
                StrengthButton = null;
            }

            if (WisdomButton != null)
            {
                WisdomButton.Dispose();
                WisdomButton = null;
            }
        }