Advertisement
dartmeadow

Untitled

Sep 14th, 2021
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 7.26 KB | None | 0 0
  1. struct pondsize {
  2. let minWidth : CGFloat = 800
  3. let minHeight : CGFloat = 660
  4. let maxWidth : CGFloat = 1920
  5. let maxHeight : CGFloat = 1620
  6. }
  7. struct Cotharticren: App {
  8.   var body: some Scene {
  9.         WindowGroup {
  10.             ContentView()
  11.         }
  12.   }
  13. }
  14.  
  15.      struct Option: Hashable {
  16.        
  17.          let title: String
  18.        
  19.          let imageName: String
  20.      }
  21.  
  22. struct ContentView: View {
  23.  
  24.     @State var currentOption = 0
  25.    
  26.     let options: [Option] = [
  27.         .init(title: "DART Meadow", imageName: "sun.max.fill"),
  28.         .init(title: "Research", imageName: "flame"),
  29.         .init(title: "Navigation", imageName: "moon.stars.fill"),
  30.         .init(title: "Shelf", imageName: "archivebox"),
  31.         .init(title: "Chest" ,imageName: "shippingbox"),
  32.         .init(title: "Crate" ,imageName: "bonjour"),
  33.         .init(title: "Manufactoring", imageName: "gear"),
  34.         .init(title: "Warehouse", imageName: "archivebox.fill"),
  35.         .init(title: "Journal", imageName: "note.text"),
  36.        
  37.     ]
  38.    
  39.     var body: some View {
  40.         VStack(alignment: .leading) {
  41.         HStack(alignment: .top) {
  42.         ScrollView( .vertical) {
  43.         NavigationView{
  44.             /*
  45.             List(1..<9)
  46.             {
  47.                      Text("\($0)")
  48.                 }
  49.             .listStyle(SidebarListStyle())
  50.             }
  51.  */
  52.             ListView(options: options, currentSelection: $currentOption)
  53.          
  54.             //Text(systemName: myItem.selectedImageName) + Text(myItem.whateverText)
  55.            
  56.             switch (currentOption) {
  57.             case 1, 2 ,3:
  58.                 OrbitNodeView()
  59.                 ATM26NodeView()
  60.                 NozzleNodeView()
  61.             case 4:
  62.                 EmptyView()
  63.             case 5:
  64.                 EmptyView()
  65.             case 6:
  66.                 EmptyView()
  67.             case 7:
  68.                 EmptyView()
  69.             case 8:
  70.                 EmptyView()
  71.            
  72.             default:
  73.                 MainView()
  74.                
  75.             }
  76.            
  77.        }.background(Color.white).listStyle(SidebarListStyle())
  78.         /*
  79.         .background(
  80.            LinearGradient(gradient: Gradient(colors: [.blue, .black, .blue, .white, .white]), startPoint: .leading, endPoint: .trailing)
  81.           )
  82.  */
  83.      /*
  84.         .background(
  85.                 RadialGradient(gradient: Gradient(colors: [.blue, .black, .blue, .white, .white]), center: .bottomLeading, startRadius: 66, endRadius: 1080)
  86.             )
  87.          */
  88.         //.background(Color.black)//init(red: 0.01, green: 0.01, blue: 1, opacity: 0.1))
  89.       // .frame(minWidth: 600, minHeight: 400)
  90.         }
  91.        
  92.     }
  93.        
  94.        
  95. }
  96.         Spacer()
  97.     }
  98. }
  99.  
  100.  
  101. struct MainView: View {
  102.  
  103.     var body: some View{
  104.         VStack(alignment: .leading) {
  105.         HStack(alignment: .top) {
  106.          
  107.              
  108.                 Image("articrenmeadowopacity")
  109.                     .shadow(radius: 3)
  110.    
  111.                    
  112.             }
  113.         }
  114.    
  115.         .frame(minWidth: pondsize().minWidth, minHeight: pondsize().minHeight)
  116.             .frame(maxWidth: pondsize().maxWidth, maxHeight: pondsize().maxHeight)
  117.             //.border(Color.yellow, width: 1)
  118.        
  119.         .background(Color.white).listStyle(SidebarListStyle())
  120.         Spacer()
  121.         }
  122.        
  123.     }
  124.  
  125.  
  126.  
  127.  
  128. struct ListView: View {
  129.     let options: [Option]
  130.     @Binding var currentSelection: Int
  131.     var body: some View{
  132.        
  133.        
  134.         VStack(alignment: .leading) {
  135.         HStack(alignment: .top) {
  136.             HStack(alignment: .top) {
  137.                 VStack(alignment: .trailing) {
  138.             Circle()
  139.                 .stroke(Color.init(red: 0.9, green: 0.95, blue: 0.2, opacity: 1), lineWidth: 2)
  140.                 .alignmentGuide(HorizontalAlignment.myAlignment)
  141.                                    { d in d[.leading] }
  142.                 .alignmentGuide(VerticalAlignment.myAlignment)
  143.                                    { d in d[.bottom] }
  144.                 .frame(width: 50, height: 50)
  145.                
  146.                         Circle()
  147.                             .stroke(Color.init(red: 0.25, green: 0.9, blue: 0.2, opacity: 1), lineWidth: 2)
  148.                             .alignmentGuide(HorizontalAlignment.myAlignment)
  149.                                                { d in d[.leading] }
  150.                             .alignmentGuide(VerticalAlignment.myAlignment)
  151.                                                { d in d[.bottom] }
  152.                             .frame(width: 25, height: 25)
  153.                             VStack(alignment: .leading) {
  154.             Circle()
  155.                 .stroke(Color.init(red: 0.1, green: 0.1, blue: 1, opacity: 1), lineWidth: 2)
  156.                 .alignmentGuide(HorizontalAlignment.myAlignment)
  157.                                    { d in d[.leading] }
  158.                 .alignmentGuide(VerticalAlignment.myAlignment)
  159.                                    { d in d[.bottom] }
  160.                 .frame(width: 75, height: 75)
  161.                 }
  162.                 }
  163.             }.listStyle(SidebarListStyle()).padding(.leading, 10)
  164.            
  165.             HStack(alignment: .top) {
  166.         Image("DARTMeadowCSMwidthArtemis2by1")
  167.                
  168.             .shadow(radius: 3)
  169.             .padding(.top, 10)
  170.             }.listStyle(SidebarListStyle())
  171.                
  172.            
  173.             .padding(.top, 20)
  174.  
  175.         .padding(.leading, 10)
  176.         .padding(.trailing, 10)
  177.         }
  178.           /*
  179.             HStack(alignment: .center) {
  180.             VStack(alignment: .center) {
  181.            
  182.             Image("crytek400")
  183.                 HStack(alignment: .center) {
  184.                 Text("You've never plotted an Edge?")
  185.                 }
  186.             }
  187.             }.shadow(radius: 3)
  188. */
  189.         VStack(alignment: .leading) {
  190.             let current = options[currentSelection]
  191.             ForEach(options, id: \.self) {option in
  192.                 HStack {
  193.                    
  194.                     Image(systemName: option.imageName)
  195.                         //.resizable()
  196.                         //.aspectRatio(contentMode: .fit)
  197.                         .frame(width: 20)
  198.                    
  199.                     Text(option.title)
  200.                         .foregroundColor(current == option ? Color.blue : Color.white)
  201.                    
  202.                 }
  203.                 .padding(8)
  204.                 .onTapGesture {
  205.                   // self.currentSelection = 0
  206.                    
  207.                     var sum:Int = 0
  208.  
  209.                     for i in 1...9 {
  210.                         sum += i  //it’s like we did 1+2+3+4+5+6+7+8+9!
  211.                
  212.                    
  213.                     if currentSelection == 1 {
  214.                         currentSelection = 0
  215.                    } else {
  216.                     currentSelection = 1
  217.                     }
  218.                     }
  219.                    
  220.                     /*
  221.                     let numbers = [1, 2, 3, 4, 5, 6]
  222.                     var sum = 0
  223.  
  224.                     for i in numbers {
  225.                         sum += i
  226.                     }
  227.  
  228.                     print(sum)
  229.  */
  230.               }
  231.             }
  232.        
  233.         }
  234.     }.padding(.top, 20).listStyle(SidebarListStyle())
  235.         Spacer()
  236.     }
  237.        
  238. }
  239.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement