コード例 #1
0
    public static List <Data_struct> Bubble_Sort_DateTime(List <Data_struct> list, DateTime[] date_time_list, bool inverted = false)
    {
        for (int x = 1; x < list.Count; x++)
        {
            bool switched = false;

            for (int y = 0; y < list.Count - x; y++)
            {
                if (Is_Sooner(date_time_list[y + 1], date_time_list[y]) == !inverted)
                {
                    Data_struct temp    = list[y];
                    DateTime    dt_temp = date_time_list[y];

                    list[y]               = list[y + 1];
                    date_time_list[y]     = date_time_list[y + 1];
                    list[y + 1]           = temp;
                    date_time_list[y + 1] = dt_temp;
                    switched              = true;
                }
            }

            if (!switched)
            {
                break;
            }
        }
        return(list);
    }
コード例 #2
0
 public override void Set_Data(Data_struct calendar_event)
 {
     this.calendar_event = (Calendar_Event)calendar_event;
     day.text            = this.calendar_event.Date_Event.Day.ToString();
     Title.text          = this.calendar_event.Title;
     month.text          = this.calendar_event.Date_Event.ToString("MMMM").Substring(0, 3);
     Meeting.text        = this.calendar_event.Location_Meeting + ", " + Utils.Get_String(this.calendar_event.Date_Meeting);
     Location_event.text = this.calendar_event.Location_Event + ", " + Utils.Get_String(this.calendar_event.Date_Event);
     Update_Color(background);
 }
コード例 #3
0
    public override void Set_Data(Data_struct news_entry)
    {
        this.news_entry    = (News_Entry)news_entry;
        Title.text         = this.news_entry.Title.ToUpper();
        Creation_time.text = this.news_entry.Creation_time.ToString("MMMM").ToUpper() + " " + this.news_entry.Creation_time.Day;

        if (this.news_entry.Seen)
        {
            image.sprite = Helper.Singleton.Sprite_Arrow_Seen;
        }
    }
コード例 #4
0
 /// <summary>
 /// Sets a specific element of the List of Data_struct elements of a specific child class type of Database_Handler.
 /// </summary>
 /// <param name="type">Child class type of Database_Handler.</param>
 /// <param name="idx">The index in the list.</param>
 /// <param name="element">The element that should be set to.</param>
 public static void Data_List_Add(Type type, Data_struct element)
 {
     if (data_list.ContainsKey(type))
     {
         data_list[type].Insert(0, element);
     }
     else
     {
         Debug.LogError("data_list does not exist.");
     }
 }
コード例 #5
0
 /// <summary>
 /// Sets a specific element of the List of Data_struct elements of a specific child class type of Database_Handler.
 /// </summary>
 /// <param name="type">Child class type of Database_Handler.</param>
 /// <param name="idx">The index in the list.</param>
 /// <param name="element">The element that should be set to.</param>
 public static void Data_List_Set(Type type, int idx, Data_struct element)
 {
     if (data_list.ContainsKey(type))
     {
         data_list[type][idx] = element;
     }
     else
     {
         Debug.LogError("data_list does not exist.");
     }
 }
コード例 #6
0
    public Data_struct Clone_Deep()
    {
        Data_struct clone = (Data_struct)Activator.CreateInstance(GetType());

        FieldInfo[] infos = GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);

        foreach (FieldInfo info in infos)
        {
            info.SetValue(clone, info.GetValue(this));
        }

        return(clone);
    }
コード例 #7
0
    public override void Set_Data(Data_struct poll)
    {
        this.poll  = (Poll)poll;
        title.text = this.poll.Title.ToUpper();

        expiration_date.text = "FINALIZA " + this.poll.Date_Deadline.ToString("dd/MM/yyyy HH:mm") + "H";

        if (this.poll.Status != "" || this.poll.Is_Past_Deadline())
        {
            arrow.sprite = Helper.Singleton.Sprite_Arrow_Seen;

            if (this.poll.Is_Past_Deadline())
            {
                title.color           = color_palette_gray(1);
                expiration_date.color = color_palette_light_gray(1);
            }
        }
    }
コード例 #8
0
    void Calculate(int _operator)
    {
        Data_struct[] data = new Data_struct[1];
        double.TryParse(InputA.text, out data[0].a);
        double.TryParse(InputB.text, out data[0].b);
        data[0]._operator = _operator;
        ComputeBuffer inBuffer  = new ComputeBuffer(1, 24);
        ComputeBuffer outBuffer = new ComputeBuffer(1, 8);
        int           kernel    = shader.FindKernel("CSMain");

        inBuffer.SetData(data);
        shader.SetBuffer(kernel, "inBuffer", inBuffer);
        shader.SetBuffer(kernel, "Result", outBuffer);
        shader.Dispatch(kernel, 1, 1, 1);
        double[] result = new double[1];
        outBuffer.GetData(result);
        inBuffer.Release();
        outBuffer.Release();
        TextResult.text = "GPU运算结果:" + System.Convert.ToDecimal(result[0]);
    }
コード例 #9
0
    static System.Collections.IEnumerator Redirect(Data_struct data)
    {
        while (Database_Handler.Data_List_Get(data.Database_Handler_Type()).Count == 0)
        {
            yield return(null);
        }

        yield return(null);

        List <Data_struct> data_list   = Database_Handler.Data_List_Get(data.Database_Handler_Type());
        Data_struct        chosen_data = data_list.Find(x => x.Id == data.Id);

        if (!chosen_data.Equals(Activator.CreateInstance(chosen_data.GetType())))
        {
            Database_Handler.Selected_Data = chosen_data;

            switch ((Notification_Sender.Redirect_Type)Enum.Parse(typeof(Notification_Sender.Redirect_Type), data.GetType().ToString()))
            {
            case Notification_Sender.Redirect_Type.Calendar_Event:
                Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.Events_details);
                break;

            case Notification_Sender.Redirect_Type.News_Entry:
                Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.News_details);
                break;

            case Notification_Sender.Redirect_Type.Poll:
                if (((Poll)chosen_data).Votable_Type == Votable_Type.Multiple_Single_Select)
                {
                    Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.Poll_details_single);
                }
                else
                {
                    Menu.Singleton.Load_Scene_Menu_Item(Menu.Menu_item.Poll_details_multi);
                }
                break;
            }
        }
    }
コード例 #10
0
 public virtual void Set_Data(Data_struct data)
 {
 }
コード例 #11
0
 public override void Set_Data(Data_struct doc)
 {
     Doc        = (Doc)doc;
     Title.text = Doc.Title;
     Date.text  = Utils.Get_String(Doc.Creation_time);
 }